diff --git a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Expander/ExpanderPage.xaml b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Expander/ExpanderPage.xaml index 28146f668d4..70d49ffe922 100644 --- a/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Expander/ExpanderPage.xaml +++ b/Microsoft.Toolkit.Uwp.SampleApp/SamplePages/Expander/ExpanderPage.xaml @@ -16,9 +16,8 @@ Foreground="White" Background="{Binding Path=BackgroundExpander1.Value, Mode=TwoWay}" IsExpanded="{Binding Path=IsExpanded1.Value, Mode=TwoWay}" - ExpandDirection="{Binding Path=ExpandDirection1.Value, Mode=TwoWay}" - DisplayMode="{Binding Path=DisplayMode1.Value, Mode=TwoWay}"> - + ExpandDirection="{Binding Path=ExpandDirection1.Value, Mode=TwoWay}"> + - + @@ -41,8 +40,7 @@ Foreground="White" Background="{Binding Path=BackgroundExpander2.Value, Mode=TwoWay}" IsExpanded="{Binding Path=IsExpanded2.Value, Mode=TwoWay}" - ExpandDirection="{Binding Path=ExpandDirection2.Value, Mode=TwoWay}" - DisplayMode="{Binding Path=DisplayMode2.Value, Mode=TwoWay}"> + ExpandDirection="{Binding Path=ExpandDirection2.Value, Mode=TwoWay}"> - + ExpandDirection="@[ExpandDirection1:Enum:ExpandDirection.Down]"> + - - + @@ -40,12 +39,11 @@ Foreground="White" Background="@[BackgroundExpander2:Brush:Black]" IsExpanded="@[IsExpanded2:Bool:True]@" - ExpandDirection="@[ExpandDirection2:Enum:ExpandDirection.Right]" - DisplayMode="@[DisplayMode2:Enum:ExpanderDisplayMode.Expand]"> + ExpandDirection="@[ExpandDirection2:Enum:ExpandDirection.Right]"> diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Constants.cs b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Constants.cs index 97f146c4fde..66bdef12ea8 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Constants.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Constants.cs @@ -18,7 +18,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls public partial class Expander { /// - /// Key of the VisualStateGroup that trigger display mode (visible/collapsed/overlay) and direction content + /// Key of the VisualStateGroup that trigger display mode (visible/collapsed) and direction content /// private const string DisplayModeAndDirectionStatesGroupStateContent = "DisplayModeAndDirectionStates"; @@ -61,27 +61,7 @@ public partial class Expander /// Key of the VisualState when expander is collapsed and expander direction is set to Up /// private const string StateContentCollapsedUp = "CollapsedUp"; - - /// - /// Key of the VisualState when expander is overlay and expander direction is set to Left - /// - private const string StateContentOverlayLeft = "OverlayLeft"; - - /// - /// Key of the VisualState when expander is overlay and expander direction is set to Down - /// - private const string StateContentOverlayDown = "OverlayDown"; - - /// - /// Key of the VisualState when expander is overlay and expander direction is set to Right - /// - private const string StateContentOverlayRight = "OverlayRight"; - - /// - /// Key of the VisualState when expander is overlay and expander direction is set to Up - /// - private const string StateContentOverlayUp = "OverlayUp"; - + /// /// Key of the UI Element that toggle IsExpanded property /// diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Properties.cs b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Properties.cs index f31b3d6b8fa..b7c13a3e0a1 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Properties.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.Properties.cs @@ -43,12 +43,6 @@ public partial class Expander public static readonly DependencyProperty ExpandDirectionProperty = DependencyProperty.Register(nameof(ExpandDirection), typeof(ExpandDirection), typeof(Expander), new PropertyMetadata(ExpandDirection.Down, OnExpandDirectionChanged)); - /// - /// Identifies the dependency property. - /// - public static readonly DependencyProperty DisplayModeProperty = - DependencyProperty.Register(nameof(DisplayMode), typeof(ExpanderDisplayMode), typeof(Expander), new PropertyMetadata(ExpanderDisplayMode.Expand, OnDisplayModeChanged)); - /// /// Identifies the dependency property. /// @@ -91,15 +85,6 @@ public ExpandDirection ExpandDirection set { SetValue(ExpandDirectionProperty, value); } } - /// - /// Gets or sets a value indicating whether the Expander control should be in Expand or Overlay mode. - /// - public ExpanderDisplayMode DisplayMode - { - get { return (ExpanderDisplayMode)GetValue(DisplayModeProperty); } - set { SetValue(DisplayModeProperty, value); } - } - /// /// Gets or sets a value indicating whether the ContentOverlay of the control. /// @@ -135,17 +120,5 @@ private static void OnExpandDirectionChanged(DependencyObject d, DependencyPrope expander.OnExpandDirectionChanged(); } } - - private static void OnDisplayModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) - { - var expander = d as Expander; - var previousDisplayMode = (ExpanderDisplayMode)e.OldValue; - var newDisplayMode = (ExpanderDisplayMode)e.NewValue; - - if (previousDisplayMode != newDisplayMode) - { - expander.OnDisplayModeOrIsExpandedChanged(); - } - } } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.cs b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.cs index d66f47724b8..651e3b04f13 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.cs +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.cs @@ -35,10 +35,6 @@ namespace Microsoft.Toolkit.Uwp.UI.Controls [TemplateVisualState(Name = StateContentCollapsedDown, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] [TemplateVisualState(Name = StateContentCollapsedRight, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] [TemplateVisualState(Name = StateContentCollapsedUp, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] - [TemplateVisualState(Name = StateContentOverlayLeft, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] - [TemplateVisualState(Name = StateContentOverlayDown, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] - [TemplateVisualState(Name = StateContentOverlayRight, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] - [TemplateVisualState(Name = StateContentOverlayUp, GroupName = DisplayModeAndDirectionStatesGroupStateContent)] [TemplatePart(Name = RootGridPart, Type = typeof(Grid))] [TemplatePart(Name = ExpanderToggleButtonPart, Type = typeof(ToggleButton))] [TemplatePart(Name = LayoutTransformerPart, Type = typeof(LayoutTransformControl))] @@ -170,16 +166,16 @@ private void UpdateDisplayModeOrExpanderDirection() switch (ExpandDirection) { case ExpandDirection.Left: - visualState = GetDisplayModeVisualState(StateContentOverlayLeft, StateContentCollapsedLeft, StateContentVisibleLeft); + visualState = GetDisplayModeVisualState(StateContentCollapsedLeft, StateContentVisibleLeft); break; case ExpandDirection.Down: - visualState = GetDisplayModeVisualState(StateContentOverlayDown, StateContentCollapsedDown, StateContentVisibleDown); + visualState = GetDisplayModeVisualState(StateContentCollapsedDown, StateContentVisibleDown); break; case ExpandDirection.Right: - visualState = GetDisplayModeVisualState(StateContentOverlayRight, StateContentCollapsedRight, StateContentVisibleRight); + visualState = GetDisplayModeVisualState(StateContentCollapsedRight, StateContentVisibleRight); break; case ExpandDirection.Up: - visualState = GetDisplayModeVisualState(StateContentOverlayUp, StateContentCollapsedUp, StateContentVisibleUp); + visualState = GetDisplayModeVisualState(StateContentCollapsedUp, StateContentVisibleUp); break; } @@ -189,22 +185,9 @@ private void UpdateDisplayModeOrExpanderDirection() } } - private string GetDisplayModeVisualState(string overlayState, string collapsedState, string visibleState) + private string GetDisplayModeVisualState(string collapsedState, string visibleState) { - if (!IsExpanded && DisplayMode == ExpanderDisplayMode.Overlay) - { - // Overlay - return overlayState; - } - - if (!IsExpanded && DisplayMode == ExpanderDisplayMode.Expand) - { - // Collapsed - return collapsedState; - } - - // Visible - return visibleState; + return IsExpanded ? visibleState : collapsedState; } } } \ No newline at end of file diff --git a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.xaml b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.xaml index ccc480e11fd..7fe53b24b39 100644 --- a/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.xaml +++ b/Microsoft.Toolkit.Uwp.UI.Controls/Expander/Expander.xaml @@ -4,6 +4,8 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" + xmlns:animations="using:Microsoft.Toolkit.Uwp.UI.Animations" + xmlns:extensions="using:Microsoft.Toolkit.Uwp.UI.Extensions" mc:Ignorable="d">