From 5feaea9b2ced8883067e29bf9d6aa3acd82efce0 Mon Sep 17 00:00:00 2001
From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Date: Thu, 16 Oct 2025 12:03:31 -0700
Subject: [PATCH 1/5] Add Complete example to SettingsCard page as well
---
components/SettingsControls/samples/SettingsCard.md | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/components/SettingsControls/samples/SettingsCard.md b/components/SettingsControls/samples/SettingsCard.md
index 667bc703..214810db 100644
--- a/components/SettingsControls/samples/SettingsCard.md
+++ b/components/SettingsControls/samples/SettingsCard.md
@@ -20,3 +20,9 @@ You can set the `Header`, `Description`, `HeaderIcon` and `Content` properties t
SettingsCard can also be turned into a button, by setting the `IsClickEnabled` property. This can be useful whenever you want your settings component to navigate to a detail page or open an external link. You can set a custom icon by setting the `ActionIcon`, or hiding it completely by setting the `IsActionIconVisible` to `false`.
> [!SAMPLE ClickableSettingsCardSample]
+
+### Settings page example
+
+The following sample provides a typical design page, following the correct Windows 11 design specifications for things like spacing, section headers and animations.
+
+> [!SAMPLE SettingsPageExample]
From b6438016c614ddb7b3f22c7adfbdeb5d6316f4ba Mon Sep 17 00:00:00 2001
From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Date: Thu, 16 Oct 2025 12:03:54 -0700
Subject: [PATCH 2/5] Fix namespace to align with controls xmlns schema we use
for SettingsExpanderSample
---
.../samples/SettingsExpanderSample.xaml | 58 +++++++++----------
1 file changed, 29 insertions(+), 29 deletions(-)
diff --git a/components/SettingsControls/samples/SettingsExpanderSample.xaml b/components/SettingsControls/samples/SettingsExpanderSample.xaml
index 7c96fb97..e7de36b2 100644
--- a/components/SettingsControls/samples/SettingsExpanderSample.xaml
+++ b/components/SettingsControls/samples/SettingsExpanderSample.xaml
@@ -1,20 +1,20 @@
-
+
-
+ Option 1
@@ -22,22 +22,22 @@
Option 3
-
-
+
+
-
-
+
+
-
+
-
+
-
+
-
-
-
+
+
+ 40
-
-
-
-
+
+
+
+
From c7fde0447989145176ab8b3c2da32d4f8d6c9411 Mon Sep 17 00:00:00 2001
From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Date: Thu, 16 Oct 2025 12:39:57 -0700
Subject: [PATCH 3/5] Initial example of how to have draggable settings
cards/expanders
TODO: Highlight gripper on hover and get Niels once over/opinion
---
.../samples/SettingsExpander.md | 20 ++++++
.../SettingsExpanderDragHandleSample.xaml | 72 +++++++++++++++++++
.../SettingsExpanderDragHandleSample.xaml.cs | 51 +++++++++++++
3 files changed, 143 insertions(+)
create mode 100644 components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml
create mode 100644 components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml.cs
diff --git a/components/SettingsControls/samples/SettingsExpander.md b/components/SettingsControls/samples/SettingsExpander.md
index 3fd0566d..8d72ca2a 100644
--- a/components/SettingsControls/samples/SettingsExpander.md
+++ b/components/SettingsControls/samples/SettingsExpander.md
@@ -26,6 +26,26 @@ You can easily override certain properties to create custom experiences. For ins
NOTE: Due to [a bug](https://github.com/microsoft/microsoft-ui-xaml/issues/3842) related to the `ItemsRepeater` used in `SettingsExpander`, there might be visual glitches whenever the `SettingsExpander` expands and a `MaxWidth` is set on a parent `StackPanel`. As a workaround, the `StackPanel` (that has the `MaxWidth` set) can be wrapped in a `Grid` to overcome this issue. See the `SettingsPageExample` for snippet.
+### Dragging Settings Cards
+
+You may use a list of `SettingsCard` or `SettingsExpander` to represent configurable items within a tool. The order of these may be something you want to track.
+
+In this case there is a conflict between the interactions with the settings card and the drag and drop interactions of a parent containing `ListView`, for instance.
+
+Therefore, it is recommended to use the drag-handle type UI approach for this scenario in having a dedicated space for re-ordering manipulation vs. interaction with the Settings control.
+
+You can see how to do this with `SettingsExpander` in the example below, however it equally works with a collection of `SettingsCard` as the main data template component as well.
+
+> [!SAMPLE SettingsExpanderDragHandleSample]
+
+The main important pieces of this example are:
+
+1. Enabling the three drag properties on the `ListView`: `CanDragItems`, `CanReorderItems`, and `AllowDrop`.
+2. Setting `SelectionMode` to `None` to prevent selection and the selection indicator from appearing.
+3. Using a simple UIElement to act as a drag handle, the pass-through of the mouse on this element to `ListView` allows the normal drag experience to work uninterrupted.
+4. Modifying the `Margin` and `Padding` values of the `ItemContainerStyle` to align cards how we want within the ListView.
+5. Overriding the `ListViewItemBackgroundPointerOver` resource to prevent the hover effect across the entire list item, the Settings Controls already have an effect here on hover.
+
### Settings page example
The following sample provides a typical design page, following the correct Windows 11 design specifications for things like spacing, section headers and animations.
diff --git a/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml b/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml
new file mode 100644
index 00000000..9e58e172
--- /dev/null
+++ b/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml.cs b/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml.cs
new file mode 100644
index 00000000..411705a7
--- /dev/null
+++ b/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml.cs
@@ -0,0 +1,51 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace SettingsControlsExperiment.Samples;
+
+[ToolkitSample(id: nameof(SettingsExpanderDragHandleSample), "SettingsExpanderDragHandle", description: "The SettingsCard/SettingsExpander can be within a collection itself which can be re-ordered.")]
+public sealed partial class SettingsExpanderDragHandleSample : Page
+{
+
+ public ObservableCollection MyDataSet = new() {
+ new()
+ {
+ Name = "First Item",
+ Info = "More about first item.",
+ LinkDescription = "Click the link for more on first item.",
+ Url = "https://microsoft.com/",
+ },
+ new()
+ {
+ Name = "Second Item",
+ Info = "More about second item.",
+ LinkDescription = "Click the link for more on second item.",
+ Url = "https://xbox.com/",
+ },
+ new()
+ {
+ Name = "Third Item",
+ Info = "More about third item.",
+ LinkDescription = "Click the link for more on third item.",
+ Url = "https://toolkitlabs.dev/",
+ },
+ };
+
+ public SettingsExpanderDragHandleSample()
+ {
+ this.InitializeComponent();
+ }
+}
+
+public class ExpandedCardInfo
+{
+ public string? Name { get; set; }
+
+ public string? Info { get; set; }
+
+ public string? LinkDescription { get; set; }
+
+ public string? Url { get; set; }
+}
+
From cb59fc85f00b365845e93cca9452b66fa584873f Mon Sep 17 00:00:00 2001
From: Michael Hawker <24302614+michael-hawker@users.noreply.github.com>
Date: Wed, 22 Oct 2025 13:01:46 -0700
Subject: [PATCH 4/5] Worked with @niels9001 to align on design elements and
fix hover state of draggable bar with Behavior
Addressed feedback from @AndrewKeepCoding to tie toggle to expander (fixes drag issue losing state)
Add some more notes on usage/behavior
Co-authored-by: Niels Laute
---
.../samples/Dependencies.props | 14 ++++---
.../samples/SettingsControls.Samples.csproj | 1 +
.../samples/SettingsExpander.md | 3 ++
.../SettingsExpanderDragHandleSample.xaml | 42 ++++++++++++++-----
.../SettingsExpanderDragHandleSample.xaml.cs | 7 +++-
5 files changed, 50 insertions(+), 17 deletions(-)
diff --git a/components/SettingsControls/samples/Dependencies.props b/components/SettingsControls/samples/Dependencies.props
index e622e1df..20f3c819 100644
--- a/components/SettingsControls/samples/Dependencies.props
+++ b/components/SettingsControls/samples/Dependencies.props
@@ -9,23 +9,27 @@
For UWP / WinAppSDK / Uno packages, place the package references here.
-->
+
+
+
+
-
+
-
+
-
-
+
+
-
+
diff --git a/components/SettingsControls/samples/SettingsControls.Samples.csproj b/components/SettingsControls/samples/SettingsControls.Samples.csproj
index 188a0f4d..de0e51d9 100644
--- a/components/SettingsControls/samples/SettingsControls.Samples.csproj
+++ b/components/SettingsControls/samples/SettingsControls.Samples.csproj
@@ -3,6 +3,7 @@
SettingsControls
+ preview
diff --git a/components/SettingsControls/samples/SettingsExpander.md b/components/SettingsControls/samples/SettingsExpander.md
index 8d72ca2a..fca3f465 100644
--- a/components/SettingsControls/samples/SettingsExpander.md
+++ b/components/SettingsControls/samples/SettingsExpander.md
@@ -45,6 +45,9 @@ The main important pieces of this example are:
3. Using a simple UIElement to act as a drag handle, the pass-through of the mouse on this element to `ListView` allows the normal drag experience to work uninterrupted.
4. Modifying the `Margin` and `Padding` values of the `ItemContainerStyle` to align cards how we want within the ListView.
5. Overriding the `ListViewItemBackgroundPointerOver` resource to prevent the hover effect across the entire list item, the Settings Controls already have an effect here on hover.
+6. Optionally, add a behavior to highlight the drag region when the pointer is over it.
+
+Note: If controls within the dragged SettingsCard/Expander state are not bound, they will be reset upon drop in some cases. E.g. a ToggleSwitch. It is best to ensure you have bound your control's states to your data model.
### Settings page example
diff --git a/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml b/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml
index 9e58e172..27f88cde 100644
--- a/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml
+++ b/components/SettingsControls/samples/SettingsExpanderDragHandleSample.xaml
@@ -1,6 +1,7 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Header="{x:Bind Name}"
+ IsExpanded="{x:Bind IsExpanded, Mode=TwoWay}">
+ OnContent="On"
+ IsOn="{x:Bind IsExpanded, Mode=TwoWay}"/>
@@ -56,6 +75,7 @@
+