diff --git a/common/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml b/common/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml
index e1487561d..358ef4590 100644
--- a/common/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml
+++ b/common/CommunityToolkit.Labs.Shared/Renderers/ToolkitSampleRenderer.xaml
@@ -143,7 +143,8 @@
diff --git a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml
index c345a33b0..51ace90a6 100644
--- a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml
+++ b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml
@@ -6,17 +6,35 @@
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
+
-
-
+
+
+ 720
+
+
+
+
- United States
- The Netherlands
- Germany
+ (2496 x 1664 (Recommended)
+ 2048 x 1536
+ 1920 x 1440
+
+
+
+
+
+
+
+
-
+
-
-
-
+
+
+
+
-
+ Glyph="" />
+
-
diff --git a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml.cs b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml.cs
index dc2234876..819427aa0 100644
--- a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml.cs
+++ b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsCardSample.xaml.cs
@@ -4,7 +4,7 @@
namespace SettingsControlsExperiment.Samples;
-[ToolkitSampleBoolOption("IsCardEnabled", "IsEnabled", true)]
+[ToolkitSampleBoolOption("IsCardEnabled", "Is Enabled", true)]
// Single values without a colon are used for both label and value.
// To provide a different label for the value, separate with a colon surrounded by a single space on both sides ("label : value").
//[ToolkitSampleMultiChoiceOption("TextSize", title: "Text size", "Small : 12", "Normal : 16", "Big : 32")]
diff --git a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.Samples.csproj b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.Samples.csproj
index a56389047..616ebeb97 100644
--- a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.Samples.csproj
+++ b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.Samples.csproj
@@ -13,10 +13,12 @@
SettingsControlsExperiment.SamplesSettingsControlsExperiment.Samples
+ 10.0
+
@@ -30,4 +32,10 @@
SettingsCardSample.xaml
+
+
+
+ SettingsExpanderSample.xaml
+
+
diff --git a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.md b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.md
index 689d03045..97a565187 100644
--- a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.md
+++ b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsControls.md
@@ -23,3 +23,8 @@ By setting the IsClickEnabled property you can turn the SettingsCard into a butt
This can be useful whenever you want your settings component to e.g. navigate to a detail page or open an external link.
> [!SAMPLE SettingsCardSample]
+
+
+The SettingsExpander can be used to group settings into a single card. SettingsCard items can be added to display settings - the orientation can be set to Vertical, Left and Right.
+
+> [!SAMPLE SettingsExpanderSample]
diff --git a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml
new file mode 100644
index 000000000..19916b918
--- /dev/null
+++ b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+ Picture
+ Solid color
+ Slideshow
+ Windows spotlight
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml.cs b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml.cs
new file mode 100644
index 000000000..a210999a7
--- /dev/null
+++ b/labs/SettingsControls/samples/SettingsControls.Samples/SettingsExpanderSample.xaml.cs
@@ -0,0 +1,25 @@
+// 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;
+
+[ToolkitSampleBoolOption("IsCardEnabled", "Is Enabled", true)]
+[ToolkitSampleBoolOption("IsCardExpanded", "Is Expanded", false)]
+// Single values without a colon are used for both label and value.
+// To provide a different label for the value, separate with a colon surrounded by a single space on both sides ("label : value").
+//[ToolkitSampleMultiChoiceOption("TextSize", title: "Text size", "Small : 12", "Normal : 16", "Big : 32")]
+//[ToolkitSampleMultiChoiceOption("TextFontFamily", title: "Font family", "Segoe UI", "Arial", "Consolas")]
+//[ToolkitSampleMultiChoiceOption("TextForeground", title: "Text foreground",
+// "Teal : #0ddc8c",
+// "Sand : #e7a676",
+// "Dull green : #5d7577")]
+
+[ToolkitSample(id: nameof(SettingsExpanderSample), "SettingsExpander", description: "The SettingsExpander can be used to group settings. SettingsCards can be customized in terms of alignment and content.")]
+public sealed partial class SettingsExpanderSample : Page
+{
+ public SettingsExpanderSample()
+ {
+ this.InitializeComponent();
+ }
+}
diff --git a/labs/SettingsControls/samples/SettingsControls.Wasm/SettingsControls.Wasm.csproj b/labs/SettingsControls/samples/SettingsControls.Wasm/SettingsControls.Wasm.csproj
index 24f948b4d..28313579d 100644
--- a/labs/SettingsControls/samples/SettingsControls.Wasm/SettingsControls.Wasm.csproj
+++ b/labs/SettingsControls/samples/SettingsControls.Wasm/SettingsControls.Wasm.csproj
@@ -18,6 +18,7 @@
falsefalsefalse
+ 10.0
diff --git a/labs/SettingsControls/src/CommunityToolkit.Labs.WinUI.SettingsControls.csproj b/labs/SettingsControls/src/CommunityToolkit.Labs.WinUI.SettingsControls.csproj
index b409ecfc0..8fe4b23e1 100644
--- a/labs/SettingsControls/src/CommunityToolkit.Labs.WinUI.SettingsControls.csproj
+++ b/labs/SettingsControls/src/CommunityToolkit.Labs.WinUI.SettingsControls.csproj
@@ -18,12 +18,13 @@
This package contains SettingsControls.
- 0.0.1
+ 0.0.2
+ 10.0
-
+
+ MSBuild:Compile
+
-
-
diff --git a/labs/SettingsControls/src/Dependencies.props b/labs/SettingsControls/src/Dependencies.props
index e622e1df4..cff9d9612 100644
--- a/labs/SettingsControls/src/Dependencies.props
+++ b/labs/SettingsControls/src/Dependencies.props
@@ -11,21 +11,21 @@
-
+
-
+
-
+
-
-
+
+
diff --git a/labs/SettingsControls/src/Helpers/ControlSizeTrigger.cs b/labs/SettingsControls/src/Helpers/ControlSizeTrigger.cs
new file mode 100644
index 000000000..b1d9d25c3
--- /dev/null
+++ b/labs/SettingsControls/src/Helpers/ControlSizeTrigger.cs
@@ -0,0 +1,17 @@
+// 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.
+
+#if WINAPPSDK
+ using ToolkitCST = CommunityToolkit.WinUI.UI.Triggers.ControlSizeTrigger;
+#else
+ using ToolkitCST = Microsoft.Toolkit.Uwp.UI.Triggers.ControlSizeTrigger;
+#endif
+
+namespace CommunityToolkit.Labs.WinUI;
+///
+/// Provide an abstraction around the Toolkit ControlSizeTrigger for both UWP and WinUI 3 in the same namespace (until 8.0).
+///
+public partial class ControlSizeTrigger : ToolkitCST
+{
+}
diff --git a/labs/SettingsControls/src/Helpers/IsEqualStateTrigger.cs b/labs/SettingsControls/src/Helpers/IsEqualStateTrigger.cs
new file mode 100644
index 000000000..79fab8b67
--- /dev/null
+++ b/labs/SettingsControls/src/Helpers/IsEqualStateTrigger.cs
@@ -0,0 +1,17 @@
+// 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.
+
+#if WINAPPSDK
+ using ToolkitIEST = CommunityToolkit.WinUI.UI.Triggers.IsEqualStateTrigger;
+#else
+using ToolkitIEST = Microsoft.Toolkit.Uwp.UI.Triggers.IsEqualStateTrigger;
+#endif
+
+namespace CommunityToolkit.Labs.WinUI;
+///
+/// Provide an abstraction around the Toolkit IsEqualStateTrigger for both UWP and WinUI 3 in the same namespace (until 8.0).
+///
+public partial class IsEqualStateTrigger : ToolkitIEST
+{
+}
diff --git a/labs/SettingsControls/src/Helpers/ResourceDictionaryExtensions.cs b/labs/SettingsControls/src/Helpers/ResourceDictionaryExtensions.cs
new file mode 100644
index 000000000..7458d3321
--- /dev/null
+++ b/labs/SettingsControls/src/Helpers/ResourceDictionaryExtensions.cs
@@ -0,0 +1,59 @@
+// 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 CommunityToolkit.Labs.WinUI;
+
+// Adapted from https://github.com/rudyhuyn/XamlPlus
+internal static class ResourceDictionaryExtensions
+{
+ ///
+ /// Copies the provided as a parameter into the calling dictionary, includes overwriting the source location, theme dictionaries, and merged dictionaries.
+ ///
+ /// ResourceDictionary to copy values to.
+ /// ResourceDictionary to copy values from.
+ internal static void CopyFrom(this ResourceDictionary destination, ResourceDictionary source)
+ {
+ if (source.Source != null)
+ {
+ destination.Source = source.Source;
+ }
+ else
+ {
+ // Clone theme dictionaries
+ if (source.ThemeDictionaries != null)
+ {
+ foreach (var theme in source.ThemeDictionaries)
+ {
+ if (theme.Value is ResourceDictionary themedResource)
+ {
+ var themeDictionary = new ResourceDictionary();
+ themeDictionary.CopyFrom(themedResource);
+ destination.ThemeDictionaries[theme.Key] = themeDictionary;
+ }
+ else
+ {
+ destination.ThemeDictionaries[theme.Key] = theme.Value;
+ }
+ }
+ }
+
+ // Clone merged dictionaries
+ if (source.MergedDictionaries != null)
+ {
+ foreach (var mergedResource in source.MergedDictionaries)
+ {
+ var themeDictionary = new ResourceDictionary();
+ themeDictionary.CopyFrom(mergedResource);
+ destination.MergedDictionaries.Add(themeDictionary);
+ }
+ }
+
+ // Clone all contents
+ foreach (var item in source)
+ {
+ destination[item.Key] = item.Value;
+ }
+ }
+ }
+}
diff --git a/labs/SettingsControls/src/Helpers/StyleExtensions.cs b/labs/SettingsControls/src/Helpers/StyleExtensions.cs
new file mode 100644
index 000000000..f6b79ee02
--- /dev/null
+++ b/labs/SettingsControls/src/Helpers/StyleExtensions.cs
@@ -0,0 +1,73 @@
+// 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 CommunityToolkit.Labs.WinUI;
+
+// Adapted from https://github.com/rudyhuyn/XamlPlus
+public static partial class StyleExtensions
+{
+ // Used to distinct normal ResourceDictionary and the one we add.
+ private sealed class StyleExtensionResourceDictionary : ResourceDictionary
+ {
+ }
+
+ public static ResourceDictionary GetResources(Style obj)
+ {
+ return (ResourceDictionary)obj.GetValue(ResourcesProperty);
+ }
+
+ public static void SetResources(Style obj, ResourceDictionary value)
+ {
+ obj.SetValue(ResourcesProperty, value);
+ }
+
+ public static readonly DependencyProperty ResourcesProperty =
+ DependencyProperty.RegisterAttached("Resources", typeof(ResourceDictionary), typeof(StyleExtensions), new PropertyMetadata(null, ResourcesChanged));
+
+ private static void ResourcesChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e)
+ {
+ if (!(sender is FrameworkElement frameworkElement))
+ {
+ return;
+ }
+
+ var mergedDictionaries = frameworkElement.Resources?.MergedDictionaries;
+ if (mergedDictionaries == null)
+ {
+ return;
+ }
+
+ var existingResourceDictionary =
+ mergedDictionaries.FirstOrDefault(c => c is StyleExtensionResourceDictionary);
+ if (existingResourceDictionary != null)
+ {
+ // Remove the existing resource dictionary
+ mergedDictionaries.Remove(existingResourceDictionary);
+ }
+
+ if (e.NewValue is ResourceDictionary resource)
+ {
+ var clonedResources = new StyleExtensionResourceDictionary();
+ clonedResources.CopyFrom(resource);
+ mergedDictionaries.Add(clonedResources);
+ }
+
+ if (frameworkElement.IsLoaded)
+ {
+ // Only force if the style was applied after the control was loaded
+ ForceControlToReloadThemeResources(frameworkElement);
+ }
+ }
+
+ private static void ForceControlToReloadThemeResources(FrameworkElement frameworkElement)
+ {
+ // To force the refresh of all resource references.
+ // Note: Doesn't work when in high-contrast.
+ var currentRequestedTheme = frameworkElement.RequestedTheme;
+ frameworkElement.RequestedTheme = currentRequestedTheme == ElementTheme.Dark
+ ? ElementTheme.Light
+ : ElementTheme.Dark;
+ frameworkElement.RequestedTheme = currentRequestedTheme;
+ }
+}
diff --git a/labs/SettingsControls/src/SettingsCard/SettingsCard.Properties.cs b/labs/SettingsControls/src/SettingsCard/SettingsCard.Properties.cs
index 0e3ac6941..1341e71c0 100644
--- a/labs/SettingsControls/src/SettingsCard/SettingsCard.Properties.cs
+++ b/labs/SettingsControls/src/SettingsCard/SettingsCard.Properties.cs
@@ -2,10 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
-using System;
-using System.Collections.Generic;
-using System.Text;
-
namespace CommunityToolkit.Labs.WinUI;
public partial class SettingsCard : ButtonBase
{
@@ -14,9 +10,9 @@ public partial class SettingsCard : ButtonBase
///
public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
nameof(Header),
- typeof(string),
+ typeof(object),
typeof(SettingsCard),
- new PropertyMetadata(defaultValue: string.Empty, (d, e) => ((SettingsCard)d).OnHeaderPropertyChanged((string)e.OldValue, (string)e.NewValue)));
+ new PropertyMetadata(defaultValue: null, (d, e) => ((SettingsCard)d).OnHeaderPropertyChanged((object)e.OldValue, (object)e.NewValue)));
///
/// The backing for the property.
@@ -28,13 +24,31 @@ public partial class SettingsCard : ButtonBase
new PropertyMetadata(defaultValue: null, (d, e) => ((SettingsCard)d).OnDescriptionPropertyChanged((object)e.OldValue, (object)e.NewValue)));
///
- /// The backing for the property.
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty HeaderIconProperty = DependencyProperty.Register(
+ nameof(HeaderIcon),
+ typeof(IconElement),
+ typeof(SettingsCard),
+ new PropertyMetadata(defaultValue: null, (d, e) => ((SettingsCard)d).OnHeaderIconPropertyChanged((IconElement)e.OldValue, (IconElement)e.NewValue)));
+
+ ///
+ /// The backing for the property.
///
- public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
- nameof(Icon),
+ public static readonly DependencyProperty ActionIconProperty = DependencyProperty.Register(
+ nameof(ActionIcon),
typeof(object),
typeof(SettingsCard),
- new PropertyMetadata(defaultValue: null, (d, e) => ((SettingsCard)d).OnIconPropertyChanged((object)e.OldValue, (object)e.NewValue)));
+ new PropertyMetadata(defaultValue: "\ue974"));
+
+ ///
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty ActionIconToolTipProperty = DependencyProperty.Register(
+ nameof(ActionIconToolTip),
+ typeof(string),
+ typeof(SettingsCard),
+ new PropertyMetadata(defaultValue: "More"));
///
/// The backing for the property.
@@ -47,16 +61,25 @@ public partial class SettingsCard : ButtonBase
///
- /// Gets or sets an example string. A basic DependencyProperty example.
+ /// The backing for the property.
///
- public string Header
+ public static readonly DependencyProperty ContentAlignmentProperty = DependencyProperty.Register(
+ nameof(ContentAlignment),
+ typeof(ContentAlignment),
+ typeof(SettingsCard),
+ new PropertyMetadata(defaultValue: ContentAlignment.Right));
+
+ ///
+ /// Gets or sets the Header.
+ ///
+ public object Header
{
- get => (string)GetValue(HeaderProperty);
+ get => (object)GetValue(HeaderProperty);
set => SetValue(HeaderProperty, value);
}
///
- /// Gets or sets an example string. A basic Description example.
+ /// Gets or sets the description.
///
#pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required
public new object Description
@@ -67,16 +90,34 @@ public string Header
}
///
- /// Gets or sets an example string. A basic DependencyProperty example.
+ /// Gets or sets the icon on the left.
+ ///
+ public IconElement HeaderIcon
+ {
+ get => (IconElement)GetValue(HeaderIconProperty);
+ set => SetValue(HeaderIconProperty, value);
+ }
+
+ ///
+ /// Gets or sets the icon that is shown when IsClickEnabled is set to true.
+ ///
+ public IconElement ActionIcon
+ {
+ get => (IconElement)GetValue(ActionIconProperty);
+ set => SetValue(ActionIconProperty, value);
+ }
+
+ ///
+ /// Gets or sets the tooltip of the ActionIcon.
///
- public object Icon
+ public string ActionIconToolTip
{
- get => (object)GetValue(IconProperty);
- set => SetValue(IconProperty, value);
+ get => (string)GetValue(ActionIconToolTipProperty);
+ set => SetValue(ActionIconToolTipProperty, value);
}
///
- /// Gets or sets an example string. A basic Description example.
+ /// Gets or sets if the card can be clicked.
///
public bool IsClickEnabled
{
@@ -84,24 +125,47 @@ public bool IsClickEnabled
set => SetValue(IsClickEnabledProperty, value);
}
+ ///
+ /// Gets or sets the alignment of the Content
+ ///
+ public ContentAlignment ContentAlignment
+ {
+ get => (ContentAlignment)GetValue(ContentAlignmentProperty);
+ set => SetValue(ContentAlignmentProperty, value);
+ }
- protected virtual void OnHeaderPropertyChanged(string oldValue, string newValue)
+ protected virtual void OnIsClickEnabledPropertyChanged(bool oldValue, bool newValue)
+ {
+ OnIsClickEnabledChanged();
+ }
+ protected virtual void OnHeaderIconPropertyChanged(IconElement oldValue, IconElement newValue)
{
- // Do something with the changed value.
+ OnHeaderIconChanged();
}
- protected virtual void OnIconPropertyChanged(object oldValue, object newValue)
+ protected virtual void OnHeaderPropertyChanged(object oldValue, object newValue)
{
- OnIconChanged();
+ OnHeaderChanged();
}
protected virtual void OnDescriptionPropertyChanged(object oldValue, object newValue)
{
OnDescriptionChanged();
}
+}
- protected virtual void OnIsClickEnabledPropertyChanged(bool oldValue, bool newValue)
- {
- OnIsClickEnabledChanged();
- }
+public enum ContentAlignment
+{
+ ///
+ /// The Content is aligned to the right. Default state.
+ ///
+ Right,
+ ///
+ /// The Content is left-aligned while the Header, HeaderIcon and Description are collapsed. This is commonly used for Content types such as CheckBoxes, RadioButtons and custom layouts.
+ ///
+ Left,
+ ///
+ /// The Content is vertically aligned.
+ ///
+ Vertical
}
diff --git a/labs/SettingsControls/src/SettingsCard/SettingsCard.cs b/labs/SettingsControls/src/SettingsCard/SettingsCard.cs
index dacb5dd04..a09649d7d 100644
--- a/labs/SettingsControls/src/SettingsCard/SettingsCard.cs
+++ b/labs/SettingsControls/src/SettingsCard/SettingsCard.cs
@@ -5,68 +5,63 @@
namespace CommunityToolkit.Labs.WinUI;
///
-/// This is an example control based off of the BoxPanel sample here: https://docs.microsoft.com/windows/apps/design/layout/boxpanel-example-custom-panel. If you need this similar sort of layout component for an application, see UniformGrid in the Toolkit.
-/// It is provided as an example of how to inherit from another control like .
+/// This is the base control to create consistent settings experiences, inline with the Windows 11 design language.
+/// A SettingsCard can also be hosted within a SettingsExpander.
///
-[TemplateVisualState(Name = IconVisibleState, GroupName = IconStates)]
-[TemplateVisualState(Name = IconCollapsedState, GroupName = IconStates)]
-[TemplateVisualState(Name = DescriptionVisibleState, GroupName = DescriptionStates)]
-[TemplateVisualState(Name = DescriptionCollapsedState, GroupName = DescriptionStates)]
public partial class SettingsCard : ButtonBase
{
- SettingsCard self;
private const string NormalState = "Normal";
private const string PointerOverState = "PointerOver";
private const string PressedState = "Pressed";
private const string DisabledState = "Disabled";
- private const string IconStates = "IconStates";
- private const string IconVisibleState = "IconVisible";
- private const string IconCollapsedState = "IconCollapsed";
-
- private const string DescriptionStates = "DescriptionStates";
- private const string DescriptionVisibleState = "DescriptionVisible";
- private const string DescriptionCollapsedState = "DescriptionCollapsed";
+ private const string RightState = "Right";
+ private const string LeftState = "Left";
+ private const string VerticalState = "Vertical";
+ private const string ActionIconPresenter = "PART_ActionIconPresenter";
+ private const string HeaderPresenter = "PART_HeaderPresenter";
+ private const string DescriptionPresenter = "PART_DescriptionPresenter";
+ private const string HeaderIconPresenter = "PART_HeaderIconPresenter";
///
/// Creates a new instance of the class.
///
public SettingsCard()
{
this.DefaultStyleKey = typeof(SettingsCard);
- self = this;
}
+ ///
protected override void OnApplyTemplate()
{
base.OnApplyTemplate();
IsEnabledChanged -= OnIsEnabledChanged;
- OnIsClickEnabledChanged();
- OnIconChanged();
+ OnButtonIconChanged();
+ OnHeaderChanged();
+ OnHeaderIconChanged();
OnDescriptionChanged();
- VisualStateManager.GoToState(this, self.IsEnabled ? NormalState : DisabledState, true);
+ OnIsClickEnabledChanged();
+ VisualStateManager.GoToState(this, IsEnabled ? NormalState : DisabledState, true);
RegisterAutomation();
-
IsEnabledChanged += OnIsEnabledChanged;
}
private void RegisterAutomation()
{
- if (self.IsClickEnabled)
+ if (Header != null && Header.GetType() == typeof(string))
{
- if (!string.IsNullOrEmpty(self.Header))
+ string? headerString = Header.ToString();
+ if (!string.IsNullOrEmpty(headerString))
{
- AutomationProperties.SetName(this, self.Header);
+ AutomationProperties.SetName(this, headerString);
}
- }
- else
- {
- if (self.Content != null && self.Content.GetType() != typeof(Button))
+
+ if (Content != null && Content.GetType() != typeof(Button))
{
// We do not want to override the default AutomationProperties.Name of a button. Its Content property already describes what it does.
- if (!string.IsNullOrEmpty(self.Header))
+ if (!string.IsNullOrEmpty(headerString))
{
- AutomationProperties.SetName((UIElement)self.Content, self.Header);
+ AutomationProperties.SetName((UIElement)Content, headerString);
}
}
}
@@ -76,31 +71,20 @@ private void EnableButtonInteraction()
{
DisableButtonInteraction();
- IsTabStop = true;
- // UseSystemFocusVisuals = true;
PointerEntered += Control_PointerEntered;
PointerExited += Control_PointerExited;
- PointerPressed += Control_PointerPressed; // TO DO: THIS EVENT DOES NOT SEEM TO EXIST IN BUTTONBASE, ONLY UIELEMENT?
- PointerReleased += Control_PointerReleased;
PreviewKeyDown += Control_PreviewKeyDown;
PreviewKeyUp += Control_PreviewKeyUp;
}
-
private void DisableButtonInteraction()
{
- IsTabStop = false;
- // UseSystemFocusVisuals = false;
PointerEntered -= Control_PointerEntered;
PointerExited -= Control_PointerExited;
- PointerPressed -= Control_PointerPressed;
- PointerReleased -= Control_PointerReleased;
PreviewKeyDown -= Control_PreviewKeyDown;
PreviewKeyUp -= Control_PreviewKeyUp;
}
-
-
private void Control_PreviewKeyUp(object sender, KeyRoutedEventArgs e)
{
if (e.Key == Windows.System.VirtualKey.Enter || e.Key == Windows.System.VirtualKey.Space || e.Key == Windows.System.VirtualKey.GamepadA)
@@ -117,12 +101,6 @@ private void Control_PreviewKeyDown(object sender, KeyRoutedEventArgs e)
}
}
- public void Control_PointerReleased(object sender, PointerRoutedEventArgs e)
- {
- base.OnPointerReleased(e);
- VisualStateManager.GoToState(this, NormalState, true);
- }
-
public void Control_PointerExited(object sender, PointerRoutedEventArgs e)
{
base.OnPointerExited(e);
@@ -133,17 +111,28 @@ public void Control_PointerEntered(object sender, PointerRoutedEventArgs e)
base.OnPointerEntered(e);
VisualStateManager.GoToState(this, PointerOverState, true);
}
-
- private void Control_PointerPressed(object sender, PointerRoutedEventArgs e)
+ protected override void OnPointerPressed(PointerRoutedEventArgs e)
+ {
+ // e.Handled = true;
+ if (IsClickEnabled)
+ {
+ base.OnPointerPressed(e);
+ VisualStateManager.GoToState(this, PressedState, true);
+ }
+ }
+ protected override void OnPointerReleased(PointerRoutedEventArgs e)
{
- base.OnPointerPressed(e);
- VisualStateManager.GoToState(this, PressedState, true);
+ if (IsClickEnabled)
+ {
+ base.OnPointerReleased(e);
+ VisualStateManager.GoToState(this, NormalState, true);
+ }
}
///
/// Creates AutomationPeer
///
- /// An automation peer for this .
+ /// An automation peer for .
protected override AutomationPeer OnCreateAutomationPeer()
{
return new SettingsCardAutomationPeer(this);
@@ -151,7 +140,7 @@ protected override AutomationPeer OnCreateAutomationPeer()
private void OnIsClickEnabledChanged()
{
- // TO DO: DISABLE THE CLICK EVENT
+ OnButtonIconChanged();
if (IsClickEnabled)
{
EnableButtonInteraction();
@@ -162,32 +151,48 @@ private void OnIsClickEnabledChanged()
}
}
- private void OnIconChanged()
+ private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ VisualStateManager.GoToState(this, IsEnabled ? NormalState : DisabledState, true);
+ }
+
+ private void OnButtonIconChanged()
{
- if (self.Icon != null)
+ if (GetTemplateChild(ActionIconPresenter) is FrameworkElement buttonIconPresenter)
{
- VisualStateManager.GoToState(this, IconVisibleState, true);
+ buttonIconPresenter.Visibility = IsClickEnabled
+ ? Visibility.Visible
+ : Visibility.Collapsed;
}
- else
+ }
+
+ private void OnHeaderIconChanged()
+ {
+ if (GetTemplateChild(HeaderIconPresenter) is FrameworkElement headerIconPresenter)
{
- VisualStateManager.GoToState(this, IconCollapsedState, true);
+ headerIconPresenter.Visibility = HeaderIcon != null
+ ? Visibility.Visible
+ : Visibility.Collapsed;
}
}
private void OnDescriptionChanged()
{
- if (self.Description != null)
- {
- VisualStateManager.GoToState(this, DescriptionVisibleState, true);
- }
- else
+ if (GetTemplateChild(DescriptionPresenter) is FrameworkElement descriptionPresenter)
{
- VisualStateManager.GoToState(this, DescriptionCollapsedState, true);
+ descriptionPresenter.Visibility = Description != null
+ ? Visibility.Visible
+ : Visibility.Collapsed;
}
}
- private void OnIsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e)
+ private void OnHeaderChanged()
{
- VisualStateManager.GoToState(this, self.IsEnabled ? NormalState : DisabledState, true);
+ if (GetTemplateChild(HeaderPresenter) is FrameworkElement headerPresenter)
+ {
+ headerPresenter.Visibility = Header != null
+ ? Visibility.Visible
+ : Visibility.Collapsed;
+ }
}
}
diff --git a/labs/SettingsControls/src/SettingsCard/SettingsCard.xaml b/labs/SettingsControls/src/SettingsCard/SettingsCard.xaml
index 21861f2e4..16af1ac88 100644
--- a/labs/SettingsControls/src/SettingsCard/SettingsCard.xaml
+++ b/labs/SettingsControls/src/SettingsCard/SettingsCard.xaml
@@ -6,7 +6,7 @@
xmlns:win="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
-
+
-
+
+
+
@@ -90,16 +92,26 @@
-
+
116,16,16,16
+ 2,0,20,0
+ 1000
+ 360
+ 68
+ 32
+ 32
+ 12
+ 20
+ 120
+ 2,0,20,0
+ 0,4,0,0
+ 460
-
-
+
@@ -310,15 +347,662 @@
+ HorizontalContentAlignment="Right"
+ Content="{TemplateBinding Content}">
+
+
+
+
-
+
+
diff --git a/labs/SettingsControls/src/SettingsCard/SettingsCardAutomationPeer.cs b/labs/SettingsControls/src/SettingsCard/SettingsCardAutomationPeer.cs
index 2a2c36eb4..91bd80f2e 100644
--- a/labs/SettingsControls/src/SettingsCard/SettingsCardAutomationPeer.cs
+++ b/labs/SettingsControls/src/SettingsCard/SettingsCardAutomationPeer.cs
@@ -7,60 +7,41 @@
using System.Text;
namespace CommunityToolkit.Labs.WinUI;
-public partial class SettingsCardAutomationPeer : FrameworkElementAutomationPeer
-{
- ///
- /// Initializes a new instance of the class.
- ///
- ///
- /// The that is associated with this .
- ///
- public SettingsCardAutomationPeer(SettingsCard owner)
- : base(owner)
- {
- }
-
- private SettingsCard? OwnerSettingsCard
- {
- get { return this.Owner as SettingsCard; }
- }
-
- ///
- /// Gets the control type for the element that is associated with the UI Automation peer.
- ///
- /// The control type.
- protected override AutomationControlType GetAutomationControlTypeCore()
- {
- return AutomationControlType.Button;
- }
///
- /// Called by GetClassName that gets a human readable name that, in addition to AutomationControlType,
- /// differentiates the control represented by this AutomationPeer.
+ /// AutomationPeer for SettingsCard
///
- /// The string that contains the name.
- protected override string GetClassNameCore()
+ public class SettingsCardAutomationPeer : FrameworkElementAutomationPeer
{
- return Owner.GetType().Name;
- }
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// SettingsCard
+ public SettingsCardAutomationPeer(SettingsCard owner)
+ : base(owner)
+ {
+ }
- ///
- /// Called by GetName.
- ///
- ///
- /// Returns the first of these that is not null or empty:
- /// - Value returned by the base implementation
- /// - Name of the owning BladeItem
- /// - BladeItem class name
- ///
- protected override string GetNameCore()
- {
- string name = AutomationProperties.GetName(this.OwnerSettingsCard);
- if (!string.IsNullOrEmpty(name))
+ ///
+ /// Gets the control type for the element that is associated with the UI Automation peer.
+ ///
+ /// The control type.
+ protected override AutomationControlType GetAutomationControlTypeCore()
{
- return name;
+ return AutomationControlType.Group;
}
- return string.Empty;
+ ///
+ /// Called by GetClassName that gets a human readable name that, in addition to AutomationControlType,
+ /// differentiates the control represented by this AutomationPeer.
+ ///
+ /// The string that contains the name.
+ protected override string GetClassNameCore()
+ {
+ string classNameCore = Owner.GetType().Name;
+#if DEBUG_AUTOMATION
+ System.Diagnostics.Debug.WriteLine("SettingsCardAutomationPeer.GetClassNameCore returns " + classNameCore);
+#endif
+ return classNameCore;
+ }
}
-}
diff --git a/labs/SettingsControls/src/SettingsCard/SettingsControls.cs b/labs/SettingsControls/src/SettingsCard/SettingsControls.cs
deleted file mode 100644
index b641b1e32..000000000
--- a/labs/SettingsControls/src/SettingsCard/SettingsControls.cs
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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 CommunityToolkit.Labs.WinUI;
-
-///
-/// This is an example control based off of the BoxPanel sample here: https://docs.microsoft.com/windows/apps/design/layout/boxpanel-example-custom-panel. If you need this similar sort of layout component for an application, see UniformGrid in the Toolkit.
-/// It is provided as an example of how to inherit from another control like .
-/// You can choose to start here or from the or example components. Remove unused components and rename as appropriate.
-///
-public partial class SettingsControls : Panel
-{
- ///
- /// Identifies the property.
- ///
- public static readonly DependencyProperty OrientationProperty =
- DependencyProperty.Register(nameof(Orientation), typeof(Orientation), typeof(SettingsControls), new PropertyMetadata(null, OnOrientationChanged));
-
- ///
- /// Gets the preference of the rows/columns when there are a non-square number of children. Defaults to Vertical.
- ///
- public Orientation Orientation
- {
- get { return (Orientation)GetValue(OrientationProperty); }
- set { SetValue(OrientationProperty, value); }
- }
-
- // Invalidate our layout when the property changes.
- private static void OnOrientationChanged(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs args)
- {
- if (dependencyObject is SettingsControls panel)
- {
- panel.InvalidateMeasure();
- }
- }
-
- // Store calculations we want to use between the Measure and Arrange methods.
- int _columnCount;
- double _cellWidth, _cellHeight;
-
- protected override Size MeasureOverride(Size availableSize)
- {
- // Determine the square that can contain this number of items.
- var maxrc = (int)Math.Ceiling(Math.Sqrt(Children.Count));
- // Get an aspect ratio from availableSize, decides whether to trim row or column.
- var aspectratio = availableSize.Width / availableSize.Height;
- if (Orientation == Orientation.Vertical) { aspectratio = 1 / aspectratio; }
-
- int rowcount;
-
- // Now trim this square down to a rect, many times an entire row or column can be omitted.
- if (aspectratio > 1)
- {
- rowcount = maxrc;
- _columnCount = (maxrc > 2 && Children.Count <= maxrc * (maxrc - 1)) ? maxrc - 1 : maxrc;
- }
- else
- {
- rowcount = (maxrc > 2 && Children.Count <= maxrc * (maxrc - 1)) ? maxrc - 1 : maxrc;
- _columnCount = maxrc;
- }
-
- // Now that we have a column count, divide available horizontal, that's our cell width.
- _cellWidth = (int)Math.Floor(availableSize.Width / _columnCount);
- // Next get a cell height, same logic of dividing available vertical by rowcount.
- _cellHeight = Double.IsInfinity(availableSize.Height) ? Double.PositiveInfinity : availableSize.Height / rowcount;
-
- double maxcellheight = 0;
-
- foreach (UIElement child in Children)
- {
- child.Measure(new Size(_cellWidth, _cellHeight));
- maxcellheight = (child.DesiredSize.Height > maxcellheight) ? child.DesiredSize.Height : maxcellheight;
- }
-
- return LimitUnboundedSize(availableSize, maxcellheight);
- }
-
- // This method limits the panel height when no limit is imposed by the panel's parent.
- // That can happen to height if the panel is close to the root of main app window.
- // In this case, base the height of a cell on the max height from desired size
- // and base the height of the panel on that number times the #rows.
- Size LimitUnboundedSize(Size input, double maxcellheight)
- {
- if (Double.IsInfinity(input.Height))
- {
- input.Height = maxcellheight * _columnCount;
- _cellHeight = maxcellheight;
- }
- return input;
- }
-
- protected override Size ArrangeOverride(Size finalSize)
- {
- int count = 1;
- double x, y;
- foreach (UIElement child in Children)
- {
- x = (count - 1) % _columnCount * _cellWidth;
- y = ((int)(count - 1) / _columnCount) * _cellHeight;
- Point anchorPoint = new Point(x, y);
- child.Arrange(new Rect(anchorPoint, child.DesiredSize));
- count++;
- }
- return finalSize;
- }
-}
diff --git a/labs/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs b/labs/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs
new file mode 100644
index 000000000..3d83d02cd
--- /dev/null
+++ b/labs/SettingsControls/src/SettingsExpander/SettingsExpander.Properties.cs
@@ -0,0 +1,104 @@
+// 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 CommunityToolkit.Labs.WinUI;
+
+[ContentProperty(Name = nameof(Content))]
+public partial class SettingsExpander : ItemsControl
+{
+ ///
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty HeaderProperty = DependencyProperty.Register(
+ nameof(Header),
+ typeof(object),
+ typeof(SettingsExpander),
+ new PropertyMetadata(defaultValue: null));
+
+ ///
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty DescriptionProperty = DependencyProperty.Register(
+ nameof(Description),
+ typeof(object),
+ typeof(SettingsExpander),
+ new PropertyMetadata(defaultValue: null));
+
+ ///
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty HeaderIconProperty = DependencyProperty.Register(
+ nameof(HeaderIcon),
+ typeof(IconElement),
+ typeof(SettingsExpander),
+ new PropertyMetadata(defaultValue: null));
+
+
+ ///
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
+ nameof(Content),
+ typeof(UIElement),
+ typeof(SettingsExpander),
+ new PropertyMetadata(defaultValue: null));
+
+ ///
+ /// The backing for the property.
+ ///
+ public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register(
+ nameof(IsExpanded),
+ typeof(bool),
+ typeof(SettingsExpander),
+ new PropertyMetadata(defaultValue: false));
+
+ ///
+ ///
+ ///
+ /// Gets or sets the Header.
+ ///
+ public object Header
+ {
+ get => (object)GetValue(HeaderProperty);
+ set => SetValue(HeaderProperty, value);
+ }
+
+ ///
+ /// Gets or sets the Description.
+ ///
+#pragma warning disable CS0109 // Member does not hide an inherited member; new keyword is not required
+ public new object Description
+#pragma warning restore CS0109 // Member does not hide an inherited member; new keyword is not required
+ {
+ get => (object)GetValue(DescriptionProperty);
+ set => SetValue(DescriptionProperty, value);
+ }
+
+ ///
+ /// Gets or sets the HeaderIcon.
+ ///
+ public IconElement HeaderIcon
+ {
+ get => (IconElement)GetValue(HeaderIconProperty);
+ set => SetValue(HeaderIconProperty, value);
+ }
+
+ ///
+ /// Gets or sets the Content.
+ ///
+ public UIElement Content
+ {
+ get => (UIElement)GetValue(ContentProperty);
+ set => SetValue(ContentProperty, value);
+ }
+
+ ///
+ /// Gets or sets the IsExpanded state.
+ ///
+ public bool IsExpanded
+ {
+ get => (bool)GetValue(IsExpandedProperty);
+ set => SetValue(IsExpandedProperty, value);
+ }
+}
diff --git a/labs/SettingsControls/src/SettingsExpander/SettingsExpander.cs b/labs/SettingsControls/src/SettingsExpander/SettingsExpander.cs
new file mode 100644
index 000000000..c5952d12a
--- /dev/null
+++ b/labs/SettingsControls/src/SettingsExpander/SettingsExpander.cs
@@ -0,0 +1,63 @@
+// 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 CommunityToolkit.Labs.WinUI;
+public partial class SettingsExpander : ItemsControl
+{
+ ///
+ /// The SettingsExpander is a collapsable control to host multiple SettingsCards.
+ ///
+ public SettingsExpander()
+ {
+ this.DefaultStyleKey = typeof(SettingsExpander);
+ }
+
+ ///
+ protected override void OnApplyTemplate()
+ {
+ base.OnApplyTemplate();
+ RegisterAutomation();
+ }
+
+ private void RegisterAutomation()
+ {
+ if (Header.GetType() == typeof(string))
+ {
+ string? headerString = Header.ToString();
+ if (!string.IsNullOrEmpty(headerString))
+ {
+ AutomationProperties.SetName(this, headerString);
+ }
+
+ if (Content != null && Content.GetType() != typeof(Button))
+ {
+ // We do not want to override the default AutomationProperties.Name of a button. Its Content property already describes what it does.
+ if (!string.IsNullOrEmpty(headerString))
+ {
+ AutomationProperties.SetName((UIElement)Content, headerString);
+ }
+ }
+ }
+
+ }
+
+ ///
+ /// Creates AutomationPeer
+ ///
+ /// An automation peer for .
+ protected override AutomationPeer OnCreateAutomationPeer()
+ {
+ return new SettingsExpanderAutomationPeer(this);
+ }
+ protected override bool IsItemItsOwnContainerOverride(object item)
+ {
+ return item is SettingsCard;
+ }
+
+ ///
+ protected override DependencyObject GetContainerForItemOverride()
+ {
+ return new SettingsCard();
+ }
+}
diff --git a/labs/SettingsControls/src/SettingsExpander/SettingsExpander.xaml b/labs/SettingsControls/src/SettingsExpander/SettingsExpander.xaml
new file mode 100644
index 000000000..fbb551328
--- /dev/null
+++ b/labs/SettingsControls/src/SettingsExpander/SettingsExpander.xaml
@@ -0,0 +1,564 @@
+
+
+
+
+
+
+
+
+ Show all settings
+ 16,16,0,16
+ 58,8,44,8
+ 0,1,0,0
+ 58,8,16,8
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/labs/SettingsControls/src/SettingsExpander/SettingsExpanderAutomationPeer.cs b/labs/SettingsControls/src/SettingsExpander/SettingsExpanderAutomationPeer.cs
new file mode 100644
index 000000000..7c3b5d49d
--- /dev/null
+++ b/labs/SettingsControls/src/SettingsExpander/SettingsExpanderAutomationPeer.cs
@@ -0,0 +1,46 @@
+// 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.
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CommunityToolkit.Labs.WinUI;
+///
+/// AutomationPeer for SettingsExpander
+///
+public class SettingsExpanderAutomationPeer : FrameworkElementAutomationPeer
+{
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// SettingsExpander
+ public SettingsExpanderAutomationPeer(SettingsExpander owner)
+ : base(owner)
+ {
+ }
+
+ ///
+ /// Gets the control type for the element that is associated with the UI Automation peer.
+ ///
+ /// The control type.
+ protected override AutomationControlType GetAutomationControlTypeCore()
+ {
+ return AutomationControlType.Group;
+ }
+
+ ///
+ /// Called by GetClassName that gets a human readable name that, in addition to AutomationControlType,
+ /// differentiates the control represented by this AutomationPeer.
+ ///
+ /// The string that contains the name.
+ protected override string GetClassNameCore()
+ {
+ string classNameCore = Owner.GetType().Name;
+#if DEBUG_AUTOMATION
+ System.Diagnostics.Debug.WriteLine("SettingsCardAutomationPeer.GetClassNameCore returns " + classNameCore);
+#endif
+ return classNameCore;
+ }
+}
diff --git a/labs/SettingsControls/src/SettingsExpander/SettingsExpanderItemStyleSelector.cs b/labs/SettingsControls/src/SettingsExpander/SettingsExpanderItemStyleSelector.cs
new file mode 100644
index 000000000..13a9f7b0b
--- /dev/null
+++ b/labs/SettingsControls/src/SettingsExpander/SettingsExpanderItemStyleSelector.cs
@@ -0,0 +1,43 @@
+// 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 CommunityToolkit.Labs.WinUI;
+
+///
+/// used by to choose the proper container style (clickable or not).
+///
+public class SettingsExpanderItemStyleSelector : StyleSelector
+{
+ ///
+ /// Gets or sets the default .
+ ///
+ public Style DefaultStyle { get; set; }
+
+ ///
+ /// Gets or sets the when clickable.
+ ///
+ public Style ClickableStyle { get; set; }
+
+ ///
+ /// Initializes a new instance of the class.
+ ///
+#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+ public SettingsExpanderItemStyleSelector()
+#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.
+ {
+ }
+
+ ///
+ protected override Style SelectStyleCore(object item, DependencyObject container)
+ {
+ if (item is SettingsCard card && card.IsClickEnabled)
+ {
+ return ClickableStyle;
+ }
+ else
+ {
+ return DefaultStyle;
+ }
+ }
+}
diff --git a/labs/SettingsControls/src/Themes/Generic.xaml b/labs/SettingsControls/src/Themes/Generic.xaml
index fec17251f..db74bedb1 100644
--- a/labs/SettingsControls/src/Themes/Generic.xaml
+++ b/labs/SettingsControls/src/Themes/Generic.xaml
@@ -1,9 +1,9 @@
-
+
+
-
diff --git a/labs/SettingsControls/tests/SettingsControls.Tests/ExampleSettingsControlsTestClass.cs b/labs/SettingsControls/tests/SettingsControls.Tests/ExampleSettingsControlsTestClass.cs
index ceee2a41d..a972c43cf 100644
--- a/labs/SettingsControls/tests/SettingsControls.Tests/ExampleSettingsControlsTestClass.cs
+++ b/labs/SettingsControls/tests/SettingsControls.Tests/ExampleSettingsControlsTestClass.cs
@@ -14,11 +14,11 @@ public partial class ExampleSettingsControlsTestClass : VisualUITestBase
[TestMethod]
public void SimpleSynchronousExampleTest()
{
- var assembly = typeof(SettingsControls).Assembly;
- var type = assembly.GetType(typeof(SettingsControls).FullName ?? string.Empty);
+ var assembly = typeof(SettingsCard).Assembly;
+ var type = assembly.GetType(typeof(SettingsCard).FullName ?? string.Empty);
- Assert.IsNotNull(type, "Could not find SettingsControls type.");
- Assert.AreEqual(typeof(SettingsControls), type, "Type of SettingsControls does not match expected type.");
+ Assert.IsNotNull(type, "Could not find SettingsCard type.");
+ Assert.AreEqual(typeof(SettingsCard), type, "Type of SettingsCard does not match expected type.");
}
// If you don't need access to UI objects directly, use this pattern.
@@ -45,7 +45,7 @@ public void SimpleExceptionCheckTest()
[LabsUITestMethod]
public void SimpleUIAttributeExampleTest()
{
- var component = new SettingsControls();
+ var component = new SettingsCard();
Assert.IsNotNull(component);
}
@@ -56,9 +56,9 @@ public void SimpleUIAttributeExampleTest()
public void SimpleUIExamplePageTest(ExampleSettingsControlsTestPage page)
{
// You can use the Toolkit Visual Tree helpers here to find the component by type or name:
- var component = page.FindDescendant();
+ //var component = page.FindDescendant();
- Assert.IsNotNull(component);
+ //Assert.IsNotNull(component);
var componentByName = page.FindDescendant("SettingsControlsControl");