Skip to content

Commit

Permalink
(GH-3812) Fix wrong space for Expander before expanded
Browse files Browse the repository at this point in the history
  • Loading branch information
punker76 committed May 26, 2020
1 parent e313e85 commit cda41b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
Expand Up @@ -90,6 +90,8 @@
<TabItem Header="Start">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
Expand Down Expand Up @@ -170,13 +172,18 @@
Header="Hidden Stuff">
<StackPanel Orientation="Vertical">
<TextBlock Text="...42..." />
<Expander ExpandDirection="Down" Header="Second Hidden Stuff">
<Expander ExpandDirection="Down"
Header="Second Hidden Stuff"
IsExpanded="True">
<StackPanel Orientation="Vertical">
<TextBlock Text="...is the Answer to the Ultimate Question of Life, The Universe, and Everything" />
</StackPanel>
</Expander>
</StackPanel>
</Expander>
<Button Grid.Row="2"
Margin="20"
Content="Beam me up..." />
</Grid>
</TabItem>
<TabItem Header="Demo">
Expand Down
4 changes: 3 additions & 1 deletion src/MahApps.Metro/Controls/Helper/ExpanderHelper.cs
@@ -1,4 +1,4 @@
using System;
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Controls;
Expand Down Expand Up @@ -121,6 +121,7 @@ private static void OnExpandStoryboardPropertyChangedCallback(DependencyObject d
}
expandSite.SetCurrentValue(UIElement.OpacityProperty, 1d);
expandSite.SetCurrentValue(UIElement.VisibilityProperty, Visibility.Visible);
}
});

Expand Down Expand Up @@ -214,6 +215,7 @@ private static void OnCollapseStoryboardPropertyChangedCallback(DependencyObject
}
expandSite.SetCurrentValue(UIElement.OpacityProperty, 0d);
expandSite.SetCurrentValue(UIElement.VisibilityProperty, Visibility.Collapsed);
}
});

Expand Down
5 changes: 4 additions & 1 deletion src/MahApps.Metro/Styles/Controls.Expander.xaml
Expand Up @@ -322,6 +322,7 @@
To="0"
Duration="0:0:0.25" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
<DiscreteObjectKeyFrame KeyTime="0:0:0.25" Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
Expand Down Expand Up @@ -393,8 +394,10 @@
CornerRadius="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Controls:ControlsHelper.CornerRadius), Converter={StaticResource CornerRadiusBindingConverter}, ConverterParameter={x:Static Converters:RadiusType.Top}}"
DockPanel.Dock="Bottom"
Focusable="false"
Opacity="0"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
UseLayoutRounding="True">
UseLayoutRounding="True"
Visibility="Collapsed">
<ContentPresenter Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Expand Down
5 changes: 4 additions & 1 deletion src/MahApps.Metro/Styles/VS/Expander.xaml
Expand Up @@ -321,6 +321,7 @@
To="0"
Duration="0:0:0.1" />
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ExpandSite" Storyboard.TargetProperty="(UIElement.Visibility)">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
<DiscreteObjectKeyFrame KeyTime="0:0:0.1" Value="{x:Static Visibility.Collapsed}" />
</ObjectAnimationUsingKeyFrames>
</Storyboard>
Expand Down Expand Up @@ -375,8 +376,10 @@
BorderThickness="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=BorderThickness, Converter={StaticResource ThicknessBindingConverter}, ConverterParameter={x:Static Converters:ThicknessSideType.Top}}"
DockPanel.Dock="Bottom"
Focusable="False"
Opacity="0"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
UseLayoutRounding="True">
UseLayoutRounding="True"
Visibility="Collapsed">
<ContentPresenter Margin="{TemplateBinding Padding}"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
Expand Down

0 comments on commit cda41b2

Please sign in to comment.