Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port microsoft/microsoft-ui-xaml#4465 #608

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ModernWpf.Controls/ContentDialog/ContentDialog.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<GridLength x:Key="ContentDialogButtonSpacing">8</GridLength>
<Thickness x:Key="ContentDialogTitleMargin">0,0,0,12</Thickness>
<Thickness x:Key="ContentDialogPadding">24</Thickness>
<Thickness x:Key="ContentDialogSeparatorThickness">0,0,0,1</Thickness>

<Style TargetType="local:ContentDialog">
<Setter Property="Foreground" Value="{DynamicResource ContentDialogForeground}" />
Expand Down Expand Up @@ -263,7 +264,11 @@
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Disabled"
IsTabStop="False">
<Border Background="{DynamicResource ContentDialogTopOverlay}" Padding="{StaticResource ContentDialogPadding}">
<Border
Background="{DynamicResource ContentDialogTopOverlay}"
Padding="{StaticResource ContentDialogPadding}"
BorderThickness="{StaticResource ContentDialogSeparatorThickness}"
BorderBrush="{DynamicResource ContentDialogSeparatorBorderBrush}">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand Down
70 changes: 25 additions & 45 deletions ModernWpf/Styles/RadioButton.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ModernWpf.Controls"
xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives">
xmlns:primitives="clr-namespace:ModernWpf.Controls.Primitives"
xmlns:sys="clr-namespace:System;assembly=mscorlib">

<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Common.xaml" />
</ResourceDictionary.MergedDictionaries>

<sys:Double x:Key="RadioButtonCheckGlyphSize">12</sys:Double>
<sys:Double x:Key="RadioButtonCheckGlyphPointerOverSize">14</sys:Double>
<sys:Double x:Key="RadioButtonCheckGlyphPressedOverSize">10</sys:Double>

<Style x:Key="DefaultRadioButtonStyle" TargetType="RadioButton">
<Setter Property="OverridesDefaultStyle" Value="True" />
<Setter Property="Background" Value="{DynamicResource RadioButtonBackground}" />
Expand Down Expand Up @@ -51,18 +56,7 @@

<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<!-- 0.86 is relative scale from 14px to 12px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="0.86" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<!-- 0.86 is relative scale from 14px to 12px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="0.86" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterEllipse" Storyboard.TargetProperty="(Shape.Stroke).(SolidColorBrush.Color)">
Expand All @@ -71,13 +65,11 @@
<ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterEllipse" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{Binding Value, Source={StaticResource RadioButtonOuterEllipseFillPointerOverProxy}, Converter={StaticResource BrushToColorConverter}}" />
</ColorAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<!-- 1.167 is relative scale from 12px to 14px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="1.167" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Width">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="14" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<!-- 1.167 is relative scale from 12px to 14px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="1.167" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Height">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="14" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
Expand All @@ -89,24 +81,20 @@
<ColorAnimationUsingKeyFrames Storyboard.TargetName="OuterEllipse" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{Binding Value, Source={StaticResource RadioButtonOuterEllipseFillPressedProxy}, Converter={StaticResource BrushToColorConverter}}" />
</ColorAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<!-- 0.71 is relative scale from 14px to 10px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="0.71" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Width">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="10" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<!-- 0.71 is relative scale from 14px to 10px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="0.71" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Height">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlNormalAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="10" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedCheckGlyph" Storyboard.TargetProperty="Opacity">
<LinearDoubleKeyFrame KeyTime="0" Value="1" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedCheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<!-- 2.5 is relative scale from 4px to 10px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="2.5" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedCheckGlyph" Storyboard.TargetProperty="Width">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="10" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedCheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<!-- 2.5 is relative scale from 4px to 10px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="2.5" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="PressedCheckGlyph" Storyboard.TargetProperty="Height">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="10" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
Expand All @@ -124,13 +112,11 @@
<ColorAnimationUsingKeyFrames Storyboard.TargetName="CheckOuterEllipse" Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)">
<LinearColorKeyFrame KeyTime="{StaticResource ControlFasterAnimationDuration}" Value="{Binding Value, Source={StaticResource RadioButtonOuterEllipseCheckedFillDisabledProxy}, Converter={StaticResource BrushToColorConverter}}" />
</ColorAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)">
<!-- 1.167 is relative scale from 12px to 14px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="1.167" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Width">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="14" />
</DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)">
<!-- 1.167 is relative scale from 12px to 14px -->
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="1.167" />
<DoubleAnimationUsingKeyFrames Storyboard.TargetName="CheckGlyph" Storyboard.TargetProperty="Height">
<SplineDoubleKeyFrame KeyTime="{StaticResource ControlFastAnimationDuration}" KeySpline="{StaticResource ControlFastOutSlowInKeySpline}" Value="14" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
Expand Down Expand Up @@ -159,16 +145,10 @@
<Ellipse x:Name="OuterEllipse" Width="20" Height="20" UseLayoutRounding="False" Stroke="{DynamicResource RadioButtonOuterEllipseStroke}" Fill="{DynamicResource RadioButtonOuterEllipseFill}" StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" />
<!-- A seperate element is added since the two orthogonal state groups that cannot touch the same property -->
<Ellipse x:Name="CheckOuterEllipse" Width="20" Height="20" UseLayoutRounding="False" Stroke="{DynamicResource RadioButtonOuterEllipseCheckedStroke}" Fill="{DynamicResource RadioButtonOuterEllipseCheckedFill}" Opacity="0" StrokeThickness="{DynamicResource RadioButtonBorderThemeThickness}" />
<Ellipse x:Name="CheckGlyph" Width="12" Height="12" RenderTransformOrigin="0.5, 0.5" UseLayoutRounding="False" Opacity="0" Fill="{DynamicResource RadioButtonCheckGlyphFill}" Stroke="{DynamicResource RadioButtonCheckGlyphStroke}">
<Ellipse.RenderTransform>
<ScaleTransform />
</Ellipse.RenderTransform>
<Ellipse x:Name="CheckGlyph" Width="{DynamicResource RadioButtonCheckGlyphSize}" Height="{DynamicResource RadioButtonCheckGlyphSize}" UseLayoutRounding="False" Opacity="0" Fill="{DynamicResource RadioButtonCheckGlyphFill}" Stroke="{DynamicResource RadioButtonCheckGlyphStroke}">
</Ellipse>
<!-- A seperate element is added since the two orthogonal state groups that cannot touch the same property -->
<Border x:Name="PressedCheckGlyph" Width="4" Height="4" CornerRadius="6" RenderTransformOrigin="0.5, 0.5" UseLayoutRounding="False" Opacity="0" Background="{DynamicResource RadioButtonCheckGlyphFill}" BorderBrush="{DynamicResource RadioButtonCheckGlyphStroke}">
<Border.RenderTransform>
<ScaleTransform />
</Border.RenderTransform>
<Border x:Name="PressedCheckGlyph" Width="4" Height="4" CornerRadius="6" UseLayoutRounding="False" Opacity="0" Background="{DynamicResource RadioButtonCheckGlyphFill}" BorderBrush="{DynamicResource RadioButtonCheckGlyphStroke}">
</Border>
</Grid>

Expand Down
3 changes: 2 additions & 1 deletion ModernWpf/ThemeResources/Dark.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,9 @@
<m:StaticResource x:Key="ContentDialogForeground" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="ContentDialogBackground" ResourceKey="SolidBackgroundFillColorBaseBrush" />
<m:StaticResource x:Key="ContentDialogSmokeFill" ResourceKey="SmokeFillColorDefaultBrush" />
<m:StaticResource x:Key="ContentDialogTopOverlay" ResourceKey="SolidBackgroundFillColorQuarternaryBrush" />
<m:StaticResource x:Key="ContentDialogTopOverlay" ResourceKey="LayerFillColorAltBrush" />
<m:StaticResource x:Key="ContentDialogBorderBrush" ResourceKey="ControlElevationBorderBrush" />
<m:StaticResource x:Key="ContentDialogSeparatorBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
<Thickness x:Key="ContentDialogBorderWidth">1</Thickness>

<!-- Resources for DataGrid -->
Expand Down
1 change: 1 addition & 0 deletions ModernWpf/ThemeResources/HighContrast.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,7 @@
<m:StaticResource x:Key="ContentDialogSmokeFill" ResourceKey="SystemColorWindowColorBrush" />
<m:StaticResource x:Key="ContentDialogTopOverlay" ResourceKey="SystemControlTransparentBrush" />
<m:StaticResource x:Key="ContentDialogBorderBrush" ResourceKey="SystemColorWindowTextColorBrush" />
<m:StaticResource x:Key="ContentDialogSeparatorBorderBrush" ResourceKey="SystemColorWindowTextColorBrush" />
<Thickness x:Key="ContentDialogBorderWidth">2</Thickness>

<!-- Resources for DataGrid -->
Expand Down
3 changes: 2 additions & 1 deletion ModernWpf/ThemeResources/Light.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,9 @@
<m:StaticResource x:Key="ContentDialogForeground" ResourceKey="TextFillColorPrimaryBrush" />
<m:StaticResource x:Key="ContentDialogBackground" ResourceKey="SolidBackgroundFillColorBaseBrush" />
<m:StaticResource x:Key="ContentDialogSmokeFill" ResourceKey="SmokeFillColorDefaultBrush" />
<m:StaticResource x:Key="ContentDialogTopOverlay" ResourceKey="SolidBackgroundFillColorQuarternaryBrush" />
<m:StaticResource x:Key="ContentDialogTopOverlay" ResourceKey="LayerFillColorAltBrush" />
<m:StaticResource x:Key="ContentDialogBorderBrush" ResourceKey="ControlElevationBorderBrush" />
<m:StaticResource x:Key="ContentDialogSeparatorBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
<Thickness x:Key="ContentDialogBorderWidth">1</Thickness>

<!-- Resources for DataGrid -->
Expand Down