diff --git a/WinUIGallery/Assets/ControlImages/LayoutPanel.png b/WinUIGallery/Assets/ControlImages/LayoutPanel.png new file mode 100644 index 000000000..ba65f59bd Binary files /dev/null and b/WinUIGallery/Assets/ControlImages/LayoutPanel.png differ diff --git a/WinUIGallery/Assets/ControlImages/PagerControl.png b/WinUIGallery/Assets/ControlImages/PagerControl.png new file mode 100644 index 000000000..b8f7d2678 Binary files /dev/null and b/WinUIGallery/Assets/ControlImages/PagerControl.png differ diff --git a/WinUIGallery/Assets/ControlImages/WrapPanel.png b/WinUIGallery/Assets/ControlImages/WrapPanel.png new file mode 100644 index 000000000..84c61d3c7 Binary files /dev/null and b/WinUIGallery/Assets/ControlImages/WrapPanel.png differ diff --git a/WinUIGallery/MainWindow.xaml b/WinUIGallery/MainWindow.xaml index 38142f5f9..242548960 100644 --- a/WinUIGallery/MainWindow.xaml +++ b/WinUIGallery/MainWindow.xaml @@ -6,6 +6,7 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="using:WinUIGallery" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:models="using:WinUIGallery.Models" xmlns:pages="using:WinUIGallery.Pages" Title="MainWindow" mc:Ignorable="d"> @@ -144,6 +145,35 @@ IsTabStop="False" Loaded="OnNavigationViewControlLoaded" SelectionChanged="OnNavigationViewSelectionChanged"> + + + + + + + + + + + + + + i.Title).Where(i => !i.IsSpecialSection)) { var itemGroup = new NavigationViewItem() { Content = group.Title, Tag = group.UniqueId, DataContext = group, Icon = GetIcon(group.IconGlyph) }; @@ -258,14 +260,22 @@ public void AddNavigationMenuItems() foreach (var item in group.Items) { - var itemInGroup = new NavigationViewItem() { IsEnabled = item.IncludedInBuild, Content = item.Title, Tag = item.UniqueId, DataContext = item }; + var itemInGroup = new NavigationViewItem() + { + IsEnabled = item.IncludedInBuild, + Content = item, + ContentTemplate = navigationItemContentTemplate, + DataContext = item, + HorizontalContentAlignment = HorizontalAlignment.Stretch, + Tag = item.UniqueId, + }; var itemInGroupMenuFlyoutItem = new MenuFlyoutItem() { Text = $"Copy Link to {item.Title} sample", Icon = new FontIcon() { Glyph = "\uE8C8" }, Tag = item }; itemInGroupMenuFlyoutItem.Click += this.OnMenuFlyoutItemClick; itemInGroup.ContextFlyout = new MenuFlyout() { Items = { itemInGroupMenuFlyoutItem } }; itemGroup.MenuItems.Add(itemInGroup); - AutomationProperties.SetName(itemInGroup, item.Title); + AutomationProperties.SetName(itemInGroup, item.IsExperimental ? $"{item.Title}, Experimental" : item.Title); AutomationProperties.SetAutomationId(itemInGroup, item.UniqueId); } @@ -529,7 +539,7 @@ public bool EnsureItemIsVisibleInNavigation(string name) { foreach (NavigationViewItem child in item.MenuItems) { - if ((string)child.Content == name) + if (child.DataContext is ControlInfoDataItem childData && childData.Title == name) { // We are the item corresponding to the selected one, update selection! diff --git a/WinUIGallery/SampleSupport/Data/ControlInfoData.json b/WinUIGallery/SampleSupport/Data/ControlInfoData.json index 4e0fc9f7f..a10d193f7 100644 --- a/WinUIGallery/SampleSupport/Data/ControlInfoData.json +++ b/WinUIGallery/SampleSupport/Data/ControlInfoData.json @@ -2284,6 +2284,33 @@ "ItemsRepeater" ] }, + { + "UniqueId": "PagerControl", + "Tags": [ + "pagination", + "pages", + "navigation" + ], + "Title": "PagerControl", + "BaseClasses": [ + "Object", + "DependencyObject", + "UIElement", + "FrameworkElement", + "Control" + ], + "ApiNamespace": "Microsoft.UI.Xaml.Controls", + "Subtitle": "A control that lets users navigate through a numbered collection of pages.", + "ImagePath": "ms-appx:///Assets/ControlImages/PagerControl.png", + "Description": "PagerControl provides numbered page navigation with multiple display modes and configurable navigation buttons.", + "SourcePath": "/PagerControl", + "IsExperimental": true, + "RelatedControls": [ + "PipsPager", + "ItemsRepeater", + "ListView" + ] + }, { "UniqueId": "ScrollView", "Tags": [ @@ -2550,7 +2577,40 @@ "RelativePanel" ] }, - + { + "UniqueId": "LayoutPanel", + "Tags": [ + "layout panel", + "custom layout", + "non virtualizing layout", + "panel" + ], + "Title": "LayoutPanel", + "BaseClasses": [ + "Object", + "DependencyObject", + "UIElement", + "FrameworkElement", + "Panel" + ], + "ApiNamespace": "Microsoft.UI.Xaml.Controls", + "Subtitle": "A panel that uses a Layout object to measure and arrange its children.", + "ImagePath": "ms-appx:///Assets/ControlImages/LayoutPanel.png", + "Description": "Use LayoutPanel to apply a reusable Layout, including a custom NonVirtualizingLayout, to ordinary panel children. LayoutPanel also provides border, corner radius, and padding properties.", + "SourcePath": "/LayoutPanel", + "IsExperimental": true, + "Docs": [ + { + "Title": "LayoutPanel - API", + "Uri": "https://learn.microsoft.com/windows/windows-app-sdk/api/winrt/microsoft.ui.xaml.controls.layoutpanel" + } + ], + "RelatedControls": [ + "Panel", + "StackLayout", + "ItemsRepeater" + ] + }, { "UniqueId": "RelativePanel", "Tags": [ @@ -2699,6 +2759,35 @@ "RelativePanel" ] }, + { + "UniqueId": "WrapPanel", + "Tags": [ + "wrap", + "responsive layout", + "flow layout", + "spacing" + ], + "Title": "WrapPanel", + "BaseClasses": [ + "Object", + "DependencyObject", + "UIElement", + "FrameworkElement", + "Panel" + ], + "ApiNamespace": "Microsoft.UI.Xaml.Controls", + "Subtitle": "A layout panel that arranges child elements in rows or columns and automatically wraps them onto new lines.", + "ImagePath": "ms-appx:///Assets/ControlImages/WrapPanel.png", + "Description": "Use a WrapPanel to arrange child elements sequentially and move overflowing items to a new row or column. You can configure its orientation, spacing, padding, and whether the final item stretches to fill the remaining space.", + "SourcePath": "/WrapPanel", + "IsExperimental": true, + "RelatedControls": [ + "StackPanel", + "VariableSizedWrapGrid", + "ItemsRepeater", + "GridView" + ] + }, { "UniqueId": "Viewbox", "Tags": [ diff --git a/WinUIGallery/Samples/ItemsRepeater/FlowLayoutVirtualization.txt b/WinUIGallery/Samples/ItemsRepeater/FlowLayoutVirtualization.txt new file mode 100644 index 000000000..a9f62b3d0 --- /dev/null +++ b/WinUIGallery/Samples/ItemsRepeater/FlowLayoutVirtualization.txt @@ -0,0 +1,29 @@ +--- header +Use FlowLayout with ItemsRepeater to wrap and virtualize a large collection. +--- xaml + + + + + + + + + + + + + +--- c# +public IReadOnlyList FlowLayoutItems { get; } = Enumerable.Range(1, 500) + .Select(index => new FlowLayoutItem($"Item {index}")) + .ToList(); + +public sealed record FlowLayoutItem(string Label); diff --git a/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml b/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml index 7d2d456fd..6e3b0b9ff 100644 --- a/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml +++ b/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml @@ -107,6 +107,21 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml.cs b/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml.cs index eca86cc6c..836106f3b 100644 --- a/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml.cs +++ b/WinUIGallery/Samples/ItemsRepeater/ItemsRepeaterPage.xaml.cs @@ -5,6 +5,7 @@ using Microsoft.UI.Xaml.Automation; using Microsoft.UI.Xaml.Automation.Peers; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; using Microsoft.UI.Xaml.Hosting; using Microsoft.UI.Xaml.Input; using System; @@ -31,6 +32,12 @@ public sealed partial class ItemsRepeaterPage : ItemsPageBase private Button? LastSelectedColorButton; private int PreviouslyFocusedAnimatedScrollRepeaterIndex = -1; + private readonly HashSet _realizedFlowLayoutElements = []; + private bool _realizedFlowLayoutCountUpdateQueued; + + public IReadOnlyList FlowLayoutItems { get; } = Enumerable.Range(1, 500) + .Select(index => new FlowLayoutItem($"Item {index}")) + .ToList(); public ItemsRepeaterPage() { @@ -250,6 +257,84 @@ private void LayoutBtn_SelectionChanged(object sender, SelectionChangedEventArgs } } + // ========================================================================== + // Virtualized wrapping collection with FlowLayout + // ========================================================================== + private void OrientationButtons_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if ((sender as RadioButtons)?.SelectedItem is RadioButton selectedItem && + Enum.TryParse(selectedItem.Tag?.ToString(), out Orientation orientation) && + FlowLayout1 is not null) + { + FlowLayout1.Orientation = orientation; + + if (FlowScrollViewer is not null) + { + bool isHorizontal = orientation == Orientation.Horizontal; + FlowScrollViewer.HorizontalScrollMode = isHorizontal ? ScrollMode.Disabled : ScrollMode.Enabled; + FlowScrollViewer.HorizontalScrollBarVisibility = isHorizontal + ? ScrollBarVisibility.Disabled + : ScrollBarVisibility.Auto; + FlowScrollViewer.VerticalScrollMode = isHorizontal ? ScrollMode.Enabled : ScrollMode.Disabled; + FlowScrollViewer.VerticalScrollBarVisibility = isHorizontal + ? ScrollBarVisibility.Auto + : ScrollBarVisibility.Disabled; + } + } + } + + private void LineAlignmentComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if ((sender as ComboBox)?.SelectedItem is ComboBoxItem selectedItem && + Enum.TryParse(selectedItem.Tag?.ToString(), out FlowLayoutLineAlignment alignment) && + FlowLayout1 is not null) + { + FlowLayout1.LineAlignment = alignment; + } + } + + private void ItemSpacingSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) + { + if (FlowLayout1 is not null) + { + FlowLayout1.MinItemSpacing = e.NewValue; + } + } + + private void LineSpacingSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) + { + if (FlowLayout1 is not null) + { + FlowLayout1.LineSpacing = e.NewValue; + } + } + + private void FlowRepeater_ElementPrepared(ItemsRepeater sender, ItemsRepeaterElementPreparedEventArgs args) + { + _realizedFlowLayoutElements.Add(args.Element); + QueueRealizedFlowLayoutCountUpdate(); + } + + private void FlowRepeater_ElementClearing(ItemsRepeater sender, ItemsRepeaterElementClearingEventArgs args) + { + _realizedFlowLayoutElements.Remove(args.Element); + QueueRealizedFlowLayoutCountUpdate(); + } + + private void QueueRealizedFlowLayoutCountUpdate() + { + if (_realizedFlowLayoutCountUpdateQueued) + { + return; + } + + _realizedFlowLayoutCountUpdateQueued = DispatcherQueue.TryEnqueue(() => + { + _realizedFlowLayoutCountUpdateQueued = false; + RealizedCountText.Text = $"Realized elements: {_realizedFlowLayoutElements.Count} of {FlowLayoutItems.Count}"; + }); + } + // ========================================================================== // Animated Scrolling ItemsRepeater with Content Sample // ========================================================================== @@ -445,6 +530,8 @@ public NestedCategory(string catName, ObservableCollection catItems) } } +public sealed record FlowLayoutItem(string Label); + public partial class MyDataTemplateSelector : DataTemplateSelector { diff --git a/WinUIGallery/Samples/LayoutPanel/FeaturedTileLayout.cs b/WinUIGallery/Samples/LayoutPanel/FeaturedTileLayout.cs new file mode 100644 index 000000000..f3d1c2ac5 --- /dev/null +++ b/WinUIGallery/Samples/LayoutPanel/FeaturedTileLayout.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using System; +using Windows.Foundation; + +namespace WinUIGallery.Layouts; + +public partial class FeaturedTileLayout : NonVirtualizingLayout +{ + public static readonly DependencyProperty SpacingProperty = DependencyProperty.Register( + nameof(Spacing), + typeof(double), + typeof(FeaturedTileLayout), + new PropertyMetadata(0d, OnSpacingChanged)); + + public double Spacing + { + get => (double)GetValue(SpacingProperty); + set => SetValue(SpacingProperty, value); + } + + protected override Size MeasureOverride(NonVirtualizingLayoutContext context, Size availableSize) + { + double width = double.IsInfinity(availableSize.Width) ? 520 : availableSize.Width; + double columnWidth = Math.Max(0, (width - Spacing) / 2); + + for (int index = 0; index < context.Children.Count; index++) + { + UIElement child = context.Children[index]; + child.Measure(new Size(index == 0 ? width : columnWidth, double.PositiveInfinity)); + } + + double totalHeight = context.Children.Count == 0 ? 0 : context.Children[0].DesiredSize.Height; + + for (int index = 1; index < context.Children.Count; index += 2) + { + totalHeight += Spacing + GetRowHeight(context, index); + } + + return new Size(width, totalHeight); + } + + protected override Size ArrangeOverride(NonVirtualizingLayoutContext context, Size finalSize) + { + if (context.Children.Count == 0) + { + return finalSize; + } + + double columnWidth = Math.Max(0, (finalSize.Width - Spacing) / 2); + UIElement featuredItem = context.Children[0]; + featuredItem.Arrange(new Rect(0, 0, finalSize.Width, featuredItem.DesiredSize.Height)); + double y = featuredItem.DesiredSize.Height; + + for (int index = 1; index < context.Children.Count; index += 2) + { + y += Spacing; + double rowHeight = GetRowHeight(context, index); + context.Children[index].Arrange(new Rect(0, y, columnWidth, rowHeight)); + + if (index + 1 < context.Children.Count) + { + context.Children[index + 1].Arrange(new Rect(columnWidth + Spacing, y, columnWidth, rowHeight)); + } + + y += rowHeight; + } + + return new Size(finalSize.Width, y); + } + + private static double GetRowHeight(NonVirtualizingLayoutContext context, int firstIndex) + { + double height = context.Children[firstIndex].DesiredSize.Height; + return firstIndex + 1 < context.Children.Count + ? Math.Max(height, context.Children[firstIndex + 1].DesiredSize.Height) + : height; + } + + private static void OnSpacingChanged(DependencyObject sender, DependencyPropertyChangedEventArgs args) + { + if (sender is FeaturedTileLayout layout) + { + layout.InvalidateMeasure(); + } + } +} diff --git a/WinUIGallery/Samples/LayoutPanel/LayoutPanelCustomLayout.txt b/WinUIGallery/Samples/LayoutPanel/LayoutPanelCustomLayout.txt new file mode 100644 index 000000000..1585092cd --- /dev/null +++ b/WinUIGallery/Samples/LayoutPanel/LayoutPanelCustomLayout.txt @@ -0,0 +1,61 @@ +--- header +LayoutPanel lets a custom Layout arrange ordinary panel children. +--- xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +--- c# +public partial class FeaturedTileLayout : NonVirtualizingLayout +{ + protected override Size MeasureOverride( + NonVirtualizingLayoutContext context, + Size availableSize) + { + // Measure the first child at full width and the remaining + // children in two columns, then return the combined extent. + // See FeaturedTileLayout.cs in the WinUI Gallery for the + // complete measure and arrange implementation. + } + + protected override Size ArrangeOverride( + NonVirtualizingLayoutContext context, + Size finalSize) + { + // Arrange the first child across the panel. Arrange each + // subsequent pair in equal-width columns. + } +} diff --git a/WinUIGallery/Samples/LayoutPanel/LayoutPanelPage.xaml b/WinUIGallery/Samples/LayoutPanel/LayoutPanelPage.xaml new file mode 100644 index 000000000..f1a4bd198 --- /dev/null +++ b/WinUIGallery/Samples/LayoutPanel/LayoutPanelPage.xaml @@ -0,0 +1,146 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/LayoutPanel/LayoutPanelPage.xaml.cs b/WinUIGallery/Samples/LayoutPanel/LayoutPanelPage.xaml.cs new file mode 100644 index 000000000..f5b5fa7de --- /dev/null +++ b/WinUIGallery/Samples/LayoutPanel/LayoutPanelPage.xaml.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Controls.Primitives; +using WinUIGallery.Layouts; + +namespace WinUIGallery.ControlPages; + +public sealed partial class LayoutPanelPage : Page +{ + private readonly StackLayout _stackLayout = new() { Orientation = Orientation.Vertical, Spacing = 8 }; + private FeaturedTileLayout? _featuredTileLayout; + + public LayoutPanelPage() + { + InitializeComponent(); + _featuredTileLayout = (FeaturedTileLayout)LayoutPanel1.Layout; + } + + private void LayoutButtons_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if ((sender as RadioButtons)?.SelectedItem is not RadioButton selectedItem || + LayoutPanel1 is null || + _featuredTileLayout is null) + { + return; + } + + LayoutPanel1.Layout = selectedItem.Tag?.ToString() == "Stack" + ? _stackLayout + : _featuredTileLayout; + } + + private void SpacingSlider_ValueChanged(object sender, RangeBaseValueChangedEventArgs e) + { + _stackLayout.Spacing = e.NewValue; + + if (_featuredTileLayout is not null) + { + _featuredTileLayout.Spacing = e.NewValue; + } + } +} diff --git a/WinUIGallery/Samples/PagerControl/PagerControlBasic.txt b/WinUIGallery/Samples/PagerControl/PagerControlBasic.txt new file mode 100644 index 000000000..4143240bc --- /dev/null +++ b/WinUIGallery/Samples/PagerControl/PagerControlBasic.txt @@ -0,0 +1,8 @@ +--- header +A basic pager +--- xaml + diff --git a/WinUIGallery/Samples/PagerControl/PagerControlDisplayModes.txt b/WinUIGallery/Samples/PagerControl/PagerControlDisplayModes.txt new file mode 100644 index 000000000..24a421c96 --- /dev/null +++ b/WinUIGallery/Samples/PagerControl/PagerControlDisplayModes.txt @@ -0,0 +1,19 @@ +--- header +Pager display modes +--- xaml + + + + diff --git a/WinUIGallery/Samples/PagerControl/PagerControlPage.xaml b/WinUIGallery/Samples/PagerControl/PagerControlPage.xaml new file mode 100644 index 000000000..336013c01 --- /dev/null +++ b/WinUIGallery/Samples/PagerControl/PagerControlPage.xaml @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/PagerControl/PagerControlPage.xaml.cs b/WinUIGallery/Samples/PagerControl/PagerControlPage.xaml.cs new file mode 100644 index 000000000..7b763500a --- /dev/null +++ b/WinUIGallery/Samples/PagerControl/PagerControlPage.xaml.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.UI.Xaml.Controls; + +namespace WinUIGallery.ControlPages; + +public sealed partial class PagerControlPage : Page +{ + public PagerControlPage() + { + InitializeComponent(); + } +} diff --git a/WinUIGallery/Samples/PagerControl/PagerControlUnbounded.txt b/WinUIGallery/Samples/PagerControl/PagerControlUnbounded.txt new file mode 100644 index 000000000..79344b86f --- /dev/null +++ b/WinUIGallery/Samples/PagerControl/PagerControlUnbounded.txt @@ -0,0 +1,17 @@ +--- header +Unbounded pagers +--- xaml + + + + diff --git a/WinUIGallery/Samples/WrapPanel/WrapPanelBasic.txt b/WinUIGallery/Samples/WrapPanel/WrapPanelBasic.txt new file mode 100644 index 000000000..ba89d2217 --- /dev/null +++ b/WinUIGallery/Samples/WrapPanel/WrapPanelBasic.txt @@ -0,0 +1,41 @@ +--- header +A WrapPanel that automatically wraps items when they reach the panel boundary. +--- xaml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/WrapPanel/WrapPanelItemsStretch.txt b/WinUIGallery/Samples/WrapPanel/WrapPanelItemsStretch.txt new file mode 100644 index 000000000..10168ea95 --- /dev/null +++ b/WinUIGallery/Samples/WrapPanel/WrapPanelItemsStretch.txt @@ -0,0 +1,27 @@ +--- header +A WrapPanel that can stretch its final item to fill the remaining space. +--- xaml + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/WrapPanel/WrapPanelPage.xaml b/WinUIGallery/Samples/WrapPanel/WrapPanelPage.xaml new file mode 100644 index 000000000..e13102e46 --- /dev/null +++ b/WinUIGallery/Samples/WrapPanel/WrapPanelPage.xaml @@ -0,0 +1,289 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WinUIGallery/Samples/WrapPanel/WrapPanelPage.xaml.cs b/WinUIGallery/Samples/WrapPanel/WrapPanelPage.xaml.cs new file mode 100644 index 000000000..ac020d193 --- /dev/null +++ b/WinUIGallery/Samples/WrapPanel/WrapPanelPage.xaml.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using System; + +namespace WinUIGallery.ControlPages; + +public sealed partial class WrapPanelPage : Page +{ + public WrapPanelPage() + { + InitializeComponent(); + } + + private void OrientationGroup_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if ((sender as RadioButtons)?.SelectedItem is not RadioButton selectedItem || + Enum.TryParse(selectedItem.Tag?.ToString(), out Orientation orientation) is false || + Control1 is null) + { + return; + } + + Control1.Orientation = orientation; + LayoutHost.Height = orientation == Orientation.Vertical ? 360 : 200; + } + + private void ItemSpacingSlider_ValueChanged(object sender, Microsoft.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e) + { + if (Control1 is not null) + { + Control1.ItemSpacing = e.NewValue; + } + } + + private void LineSpacingSlider_ValueChanged(object sender, Microsoft.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e) + { + if (Control1 is not null) + { + Control1.LineSpacing = e.NewValue; + } + } + + private void PaddingSlider_ValueChanged(object sender, Microsoft.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e) + { + if (Control1 is not null) + { + Control1.Padding = new Thickness(e.NewValue); + } + } + + private void StretchLastItemToggle_Toggled(object sender, RoutedEventArgs e) + { + if (sender is ToggleSwitch toggleSwitch && Control2 is not null) + { + Control2.ItemsStretch = toggleSwitch.IsOn ? WrapPanelItemsStretch.Last : WrapPanelItemsStretch.None; + } + } +} diff --git a/tests/WinUIGallery.UITests/Tests/AxeScanAllTests.cs b/tests/WinUIGallery.UITests/Tests/AxeScanAllTests.cs index a256ee83b..cdbe453d0 100644 --- a/tests/WinUIGallery.UITests/Tests/AxeScanAllTests.cs +++ b/tests/WinUIGallery.UITests/Tests/AxeScanAllTests.cs @@ -33,6 +33,8 @@ public class AxeScanAll : TestBase // parallel tree walk, before any rule filtering can take effect, so per-rule // exclusions are insufficient. "WebView2", + // The experimental PagerControl crashes the app when Axe.Windows walks its UIA tree. + "PagerControl", // MapControl is internally backed by a WebView2 hosting Azure Maps. The system // control has no public Dispose path, so its embedded WebView2 (and its UIA // Pane + Chromium RootWebArea) leaks into the process tree even after the page