Fix pipeline with waskd2 experimental version (#44357)

<!-- Enter a brief description/summary of your PR here. What does it
fix/what does it change/how was it tested (even manually, if necessary)?
-->
## Summary of the Pull Request
This pull request includes two main groups of changes: improvements to
build configuration (specifically, warning suppression for experimental
features), and refactoring in the `WrapPanelCustom` control to use the
correct `StretchChild` type from the CommunityToolkit. These updates
help streamline the build process and improve code clarity and
maintainability.

**Build configuration improvements:**

* Added `/p:IgnoreExperimentalWarnings=true` to the
`RestoreAdditionalProjectSourcesArg` in the build pipeline to enable
suppression of experimental warnings during project restore.
* Updated `Directory.Build.targets` to append specific warning codes
(`CS8305`, `SA1500`, `CA1852`) to the `NoWarn` property when
`IgnoreExperimentalWarnings` is set, suppressing these warnings during
builds.

**Refactoring in `WrapPanelCustom`:**

* Updated the `WrapPanel` control in `WrapPanel.cs` to use
`ToolkitStretchChild` from `CommunityToolkit.WinUI.Controls` instead of
a local `StretchChild` type, ensuring consistency and leveraging the
toolkit's implementation.
[[1]](diffhunk://#diff-53e4c6a2890b6fb1c66ea8a19f0049070910083608f8fb80c2b1f5a8d254d007R11-R12)
[[2]](diffhunk://#diff-53e4c6a2890b6fb1c66ea8a19f0049070910083608f8fb80c2b1f5a8d254d007L180-R184)
[[3]](diffhunk://#diff-53e4c6a2890b6fb1c66ea8a19f0049070910083608f8fb80c2b1f5a8d254d007L193-R197)
[[4]](diffhunk://#diff-53e4c6a2890b6fb1c66ea8a19f0049070910083608f8fb80c2b1f5a8d254d007L400-R402)
<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist

- [ ] Closes: #xxx
<!-- - [ ] Closes: #yyy (add separate lines for additional resolved
issues) -->
- [ ] **Communication:** I've discussed this with core contributors
already. If the work hasn't been agreed, this work might be rejected
- [ ] **Tests:** Added/updated and all pass
- [ ] **Localization:** All end-user-facing strings can be localized
- [ ] **Dev docs:** Added/updated
- [ ] **New binaries:** Added on the required places
- [ ] [JSON for
signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json)
for new binaries
- [ ] [WXS for
installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs)
for new binaries and localization folder
- [ ] [YML for CI
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml)
for new test projects
- [ ] [YML for signed
pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml)
- [ ] **Documentation updated:** If checked, please file a pull request
on [our docs
repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys)
and link it here: #xxx

<!-- Provide a more detailed description of the PR, other things fixed,
or any additional comments/features here -->
## Detailed Description of the Pull Request / Additional comments

<!-- Describe how you validated the behavior. Add automated tests
wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
This commit is contained in:
Shawn Yuan 2025-12-19 16:02:17 +08:00 committed by GitHub
parent dd138fb94b
commit 2603efc8a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 12 additions and 6 deletions

View File

@ -129,7 +129,7 @@ jobs:
MSBuildMainBuildTargets: Build MSBuildMainBuildTargets: Build
${{ insert }}: ${{ parameters.variables }} ${{ insert }}: ${{ parameters.variables }}
${{ if eq(parameters.useLatestWinAppSDK, true) }}: ${{ if eq(parameters.useLatestWinAppSDK, true) }}:
RestoreAdditionalProjectSourcesArg: '/p:RestoreAdditionalProjectSources="$(Build.SourcesDirectory)\localpackages\NugetPackages"' RestoreAdditionalProjectSourcesArg: '/p:RestoreAdditionalProjectSources="$(Build.SourcesDirectory)\localpackages\NugetPackages" /p:IgnoreExperimentalWarnings=true'
${{ else }}: ${{ else }}:
RestoreAdditionalProjectSourcesArg: '' RestoreAdditionalProjectSourcesArg: ''
displayName: Build displayName: Build

View File

@ -24,4 +24,8 @@
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Restore" Properties="RestoreInProgress=true" BuildInParallel="false" /> <MSBuild Projects="$(MSBuildProjectFullPath)" Targets="Restore" Properties="RestoreInProgress=true" BuildInParallel="false" />
</Target> </Target>
<PropertyGroup Condition="'$(IgnoreExperimentalWarnings)' == 'true'">
<NoWarn>$(NoWarn);CS8305;SA1500;CA1852</NoWarn>
</PropertyGroup>
</Project> </Project>

View File

@ -8,6 +8,8 @@ using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Controls;
using Windows.Foundation; using Windows.Foundation;
using ToolkitStretchChild = CommunityToolkit.WinUI.Controls.StretchChild;
namespace Microsoft.CmdPal.UI.Controls; namespace Microsoft.CmdPal.UI.Controls;
/// <summary> /// <summary>
@ -177,9 +179,9 @@ public sealed partial class WrapPanel : Panel
/// <summary> /// <summary>
/// Gets or sets a value indicating how to arrange child items /// Gets or sets a value indicating how to arrange child items
/// </summary> /// </summary>
public StretchChild StretchChild public ToolkitStretchChild StretchChild
{ {
get { return (StretchChild)GetValue(StretchChildProperty); } get { return (ToolkitStretchChild)GetValue(StretchChildProperty); }
set { SetValue(StretchChildProperty, value); } set { SetValue(StretchChildProperty, value); }
} }
@ -190,9 +192,9 @@ public sealed partial class WrapPanel : Panel
public static readonly DependencyProperty StretchChildProperty = public static readonly DependencyProperty StretchChildProperty =
DependencyProperty.Register( DependencyProperty.Register(
nameof(StretchChild), nameof(StretchChild),
typeof(StretchChild), typeof(ToolkitStretchChild),
typeof(WrapPanel), typeof(WrapPanel),
new PropertyMetadata(StretchChild.None, LayoutPropertyChanged)); new PropertyMetadata(ToolkitStretchChild.None, LayoutPropertyChanged));
/// <summary> /// <summary>
/// Identifies the IsFullLine attached dependency property. /// Identifies the IsFullLine attached dependency property.
@ -397,7 +399,7 @@ public sealed partial class WrapPanel : Panel
Arrange(Children[i]); Arrange(Children[i]);
} }
Arrange(Children[lastIndex], StretchChild == StretchChild.Last); Arrange(Children[lastIndex], StretchChild == ToolkitStretchChild.Last);
if (currentRow.ChildrenRects.Count > 0) if (currentRow.ChildrenRects.Count > 0)
{ {