Skip to content

Commit

Permalink
Enable shadow by default for ContentDialog
Browse files Browse the repository at this point in the history
  • Loading branch information
Kinnara committed Mar 27, 2020
1 parent 7fc8d4c commit ce3698c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions ModernWpf.Controls/ContentDialog/ContentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Disabled" />
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="IsShadowEnabled" Value="{DynamicResource {x:Static SystemParameters.DropShadowKey}}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:ContentDialog">
Expand All @@ -26,6 +27,9 @@
<VisualStateGroup.Transitions>
<VisualTransition To="DialogHidden" GeneratedDuration="0:0:0.5">
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="SnapsToDevicePixels">
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
</BooleanAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
Expand All @@ -48,6 +52,9 @@
</VisualTransition>
<VisualTransition To="DialogShowing" GeneratedDuration="0:0:0.5">
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="SnapsToDevicePixels">
<DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="False" />
</BooleanAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame KeyTime="0:0:0" Value="{x:Static Visibility.Visible}" />
</ObjectAnimationUsingKeyFrames>
Expand Down
3 changes: 1 addition & 2 deletions ModernWpf.SampleApp/ControlPages/ContentDialogExample.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
PrimaryButtonText="Save"
SecondaryButtonText="Don't Save"
CloseButtonText="Cancel"
DefaultButton="Primary"
IsShadowEnabled="{DynamicResource {x:Static SystemParameters.DropShadowKey}}">
DefaultButton="Primary">

<StackPanel VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
<!-- Content body -->
Expand Down
1 change: 0 additions & 1 deletion samples/FluentRibbonSample/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ private async void ShowContentDialog(object sender, RoutedEventArgs e)
CloseButtonText = "Cancel",
DefaultButton = ContentDialogButton.Primary,
};
dialog.SetResourceReference(ContentDialog.IsShadowEnabledProperty, SystemParameters.DropShadowKey);
await dialog.ShowAsync();
}
}
Expand Down

0 comments on commit ce3698c

Please sign in to comment.