enhance: high dpi optimization.

This commit is contained in:
NaBian committed 2023-01-22 22:26:11 +08:00
1 parent 37d69e1906
commit 6c353093f6
2 files changed
+121 -117

No files matched your search

@@ -9,87 +9,89 @@
<Setter Property="Control.Template"> <Setter Property="Control.Template">
<Setter.Value> <Setter.Value>
<ControlTemplate> <ControlTemplate>
<Rectangle Margin="-4" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="4" RadiusY="4"/> <Rectangle Margin="-4" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="4" RadiusY="4" />
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="Background" Value="White"/> <Setter Property="Background" Value="White" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalAlignment" Value="Stretch"/> <Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="6,0,0,0"/> <Setter Property="Padding" Value="6,0,0,0" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="CheckBox"> <ControlTemplate TargetType="CheckBox">
<ControlTemplate.Resources> <ControlTemplate.Resources>
<Storyboard x:Key="StoryboardCheckedTrue"> <Storyboard x:Key="StoryboardCheckedTrue">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeDashOffset)" Storyboard.TargetName="path"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeDashOffset)" Storyboard.TargetName="path">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/> <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0" />
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
<Storyboard x:Key="StoryboardCheckedFalse"> <Storyboard x:Key="StoryboardCheckedFalse">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeDashOffset)" Storyboard.TargetName="path"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.StrokeDashOffset)" Storyboard.TargetName="path">
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="8"/> <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="8" />
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
</ControlTemplate.Resources> </ControlTemplate.Resources>
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True"> <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/> <ColumnDefinition Width="*" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Height="16" Width="16" x:Name="checkBoxBorder" Background="{TemplateBinding Background}" CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}"/> <Border Height="16" Width="16" Background="{TemplateBinding Background}" CornerRadius="2" />
<hc:SimplePanel Grid.Column="0" Height="16" Width="16" x:Name="markGrid"> <hc:SimplePanel Grid.Column="0" Height="16" Width="16" x:Name="markGrid">
<Path FlowDirection="LeftToRight" UseLayoutRounding="True" x:Name="path" StrokeDashOffset="8" StrokeDashArray="8,8" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}"/> <Path FlowDirection="LeftToRight" UseLayoutRounding="True" x:Name="path" StrokeDashOffset="8" StrokeDashArray="8,8" Width="12" Height="12" Data="{StaticResource CheckedGeometry}" StrokeThickness="2" Stretch="Uniform" Stroke="{DynamicResource TextIconBrush}" />
<Rectangle x:Name="indeterminateMark" RadiusX="2" RadiusY="2" Fill="{DynamicResource PrimaryBrush}" Margin="2" Opacity="0"/> <Rectangle x:Name="indeterminateMark" RadiusX="2" RadiusY="2" Fill="{DynamicResource PrimaryBrush}" Margin="2" Opacity="0" />
</hc:SimplePanel> </hc:SimplePanel>
<ContentPresenter x:Name="contentPresenter" Visibility="Collapsed" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> <Border Height="16" Width="16" x:Name="border" CornerRadius="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" />
<ContentPresenter x:Name="contentPresenter" Visibility="Collapsed" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="true"> <Trigger Property="HasContent" Value="true">
<Setter Property="Visibility" TargetName="contentPresenter" Value="Visible"/> <Setter Property="Visibility" TargetName="contentPresenter" Value="Visible" />
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="true"> <Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
</Trigger> </Trigger>
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="true"/> <Condition Property="IsChecked" Value="true" />
<Condition Property="IsPressed" Value="true"/> <Condition Property="IsPressed" Value="true" />
</MultiTrigger.Conditions> </MultiTrigger.Conditions>
<Setter Property="Opacity" Value=".8"/> <Setter Property="Opacity" Value=".8" />
</MultiTrigger> </MultiTrigger>
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false"/> <Condition Property="IsChecked" Value="false" />
<Condition Property="IsPressed" Value="true"/> <Condition Property="IsPressed" Value="true" />
</MultiTrigger.Conditions> </MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
</MultiTrigger> </MultiTrigger>
<Trigger Property="IsChecked" Value="true"> <Trigger Property="IsChecked" Value="true">
<Trigger.EnterActions> <Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardCheckedTrue}"/> <BeginStoryboard Storyboard="{StaticResource StoryboardCheckedTrue}" />
</Trigger.EnterActions> </Trigger.EnterActions>
<Trigger.ExitActions> <Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardCheckedFalse}"/> <BeginStoryboard Storyboard="{StaticResource StoryboardCheckedFalse}" />
</Trigger.ExitActions> </Trigger.ExitActions>
<Setter Property="Opacity" TargetName="indeterminateMark" Value="0"/> <Setter Property="Opacity" TargetName="indeterminateMark" Value="0" />
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}" />
<Setter TargetName="border" Property="Visibility" Value="Collapsed" />
</Trigger> </Trigger>
<Trigger Property="IsChecked" Value="false"> <Trigger Property="IsChecked" Value="false">
<Setter Property="Stroke" Value="{DynamicResource BorderBrush}" TargetName="path"/> <Setter Property="Stroke" Value="{DynamicResource BorderBrush}" TargetName="path" />
</Trigger> </Trigger>
<Trigger Property="IsChecked" Value="{x:Null}"> <Trigger Property="IsChecked" Value="{x:Null}">
<Setter Property="Opacity" TargetName="indeterminateMark" Value="1"/> <Setter Property="Opacity" TargetName="indeterminateMark" Value="1" />
</Trigger> </Trigger>
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/> <Setter Property="Opacity" Value="0.4" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -10,90 +10,92 @@
<Setter Property="Control.Template"> <Setter Property="Control.Template">
<Setter.Value> <Setter.Value>
<ControlTemplate> <ControlTemplate>
<Rectangle Margin="-4" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="4" RadiusY="4"/> <Rectangle Margin="-4" Opacity=".6" SnapsToDevicePixels="true" Stroke="{DynamicResource SecondaryBorderBrush}" StrokeThickness="2" StrokeDashArray="1 1" RadiusX="4" RadiusY="4" />
</ControlTemplate> </ControlTemplate>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
</Style> </Style>
</Setter.Value> </Setter.Value>
</Setter> </Setter>
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/> <Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="HorizontalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center" />
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="Padding" Value="6,0,0,0"/> <Setter Property="Padding" Value="6,0,0,0" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="RadioButton"> <ControlTemplate TargetType="RadioButton">
<ControlTemplate.Resources> <ControlTemplate.Resources>
<Storyboard x:Key="StoryboardCheckedTrue"> <Storyboard x:Key="StoryboardCheckedTrue">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="optionMark"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="optionMark">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.5"/> <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="optionMark"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="optionMark">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0.5"/> <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1" />
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
<Storyboard x:Key="StoryboardCheckedFalse"> <Storyboard x:Key="StoryboardCheckedFalse">
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="optionMark"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="optionMark">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/> <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0" />
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="optionMark"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="optionMark">
<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/> <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0" />
</DoubleAnimationUsingKeyFrames> </DoubleAnimationUsingKeyFrames>
</Storyboard> </Storyboard>
</ControlTemplate.Resources> </ControlTemplate.Resources>
<Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True"> <Grid x:Name="templateRoot" Background="Transparent" SnapsToDevicePixels="True">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*"/> <ColumnDefinition />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<Border Height="18" Width="18" x:Name="radioButtonBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" CornerRadius="100" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"> <Border Height="16" Width="16" Background="{TemplateBinding Background}" CornerRadius="8" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
<Ellipse x:Name="optionMark" Fill="White" MinWidth="6" MinHeight="6" RenderTransformOrigin="0.5,0.5"> <Ellipse x:Name="optionMark" HorizontalAlignment="Center" VerticalAlignment="Center" Grid.Column="0" Fill="White" Width="8" Height="8" RenderTransformOrigin="0.5,0.5">
<Ellipse.RenderTransform> <Ellipse.RenderTransform>
<TransformGroup> <TransformGroup>
<ScaleTransform/> <ScaleTransform ScaleX="0" ScaleY="0" />
</TransformGroup> </TransformGroup>
</Ellipse.RenderTransform> </Ellipse.RenderTransform>
</Ellipse> </Ellipse>
</Border> </Border>
<ContentPresenter x:Name="contentPresenter" Visibility="Collapsed" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> <Border x:Name="border" Grid.Column="0" Height="16" Width="16" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" CornerRadius="8" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
<ContentPresenter x:Name="contentPresenter" Visibility="Collapsed" Grid.Column="1" Focusable="False" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid> </Grid>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="HasContent" Value="true"> <Trigger Property="HasContent" Value="true">
<Setter Property="Visibility" TargetName="contentPresenter" Value="Visible"/> <Setter Property="Visibility" TargetName="contentPresenter" Value="Visible" />
</Trigger> </Trigger>
<Trigger Property="IsMouseOver" Value="true"> <Trigger Property="IsMouseOver" Value="true">
<Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}" />
</Trigger> </Trigger>
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="true"/> <Condition Property="IsChecked" Value="true" />
<Condition Property="IsPressed" Value="true"/> <Condition Property="IsPressed" Value="true" />
</MultiTrigger.Conditions> </MultiTrigger.Conditions>
<Setter Property="Opacity" Value=".8"/> <Setter Property="Opacity" Value=".8" />
</MultiTrigger> </MultiTrigger>
<MultiTrigger> <MultiTrigger>
<MultiTrigger.Conditions> <MultiTrigger.Conditions>
<Condition Property="IsChecked" Value="false"/> <Condition Property="IsChecked" Value="false" />
<Condition Property="IsPressed" Value="true"/> <Condition Property="IsPressed" Value="true" />
</MultiTrigger.Conditions> </MultiTrigger.Conditions>
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}" />
</MultiTrigger> </MultiTrigger>
<Trigger Property="IsChecked" Value="true"> <Trigger Property="IsChecked" Value="true">
<Trigger.EnterActions> <Trigger.EnterActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardCheckedTrue}"/> <BeginStoryboard Storyboard="{StaticResource StoryboardCheckedTrue}" />
</Trigger.EnterActions> </Trigger.EnterActions>
<Trigger.ExitActions> <Trigger.ExitActions>
<BeginStoryboard Storyboard="{StaticResource StoryboardCheckedFalse}"/> <BeginStoryboard Storyboard="{StaticResource StoryboardCheckedFalse}" />
</Trigger.ExitActions> </Trigger.ExitActions>
<Setter Property="Background" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="Background" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource DarkPrimaryBrush}" />
<Setter TargetName="border" Property="Visibility" Value="Collapsed" />
</Trigger> </Trigger>
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/> <Setter Property="Opacity" Value="0.4" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -102,31 +104,31 @@
</Style> </Style>
<Style x:Key="RadioButtonSameAsButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="RadioButton"> <Style x:Key="RadioButtonSameAsButtonBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="RadioButton">
<Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/> <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="RadioButton"> <ControlTemplate TargetType="RadioButton">
<hc:SimplePanel> <hc:SimplePanel>
<Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"/> <Border Background="{TemplateBinding Background}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" />
<Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}"> <Border BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<Path x:Name="PathMain" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}"/> <Path x:Name="PathMain" Width="{TemplateBinding hc:IconElement.Width}" Height="{TemplateBinding hc:IconElement.Height}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> <ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</StackPanel> </StackPanel>
</Border> </Border>
<Border Margin="-1" Visibility="Collapsed" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{DynamicResource DarkMaskBrush}"/> <Border Margin="-1" Visibility="Collapsed" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="BorderChecked" BorderThickness="4" BorderBrush="{DynamicResource DarkMaskBrush}" />
</hc:SimplePanel> </hc:SimplePanel>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true"> <Trigger Property="IsChecked" Value="true">
<Setter TargetName="BorderChecked" Property="Visibility" Value="Visible"/> <Setter TargetName="BorderChecked" Property="Visibility" Value="Visible" />
</Trigger> </Trigger>
<Trigger Property="Content" Value="{x:Null}"> <Trigger Property="Content" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain"/> <Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
</Trigger> </Trigger>
<Trigger Property="hc:IconElement.Geometry" Value="{x:Null}"> <Trigger Property="hc:IconElement.Geometry" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PathMain" />
<Setter Property="Margin" Value="0" TargetName="ContentPresenterMain"/> <Setter Property="Margin" Value="0" TargetName="ContentPresenterMain" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -134,45 +136,45 @@
</Setter> </Setter>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9"/> <Setter Property="Opacity" Value=".9" />
</Trigger> </Trigger>
<Trigger Property="IsPressed" Value="True"> <Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value=".6"/> <Setter Property="Opacity" Value=".6" />
</Trigger> </Trigger>
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/> <Setter Property="Opacity" Value="0.4" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="RadioButtonIconBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="RadioButton"> <Style x:Key="RadioButtonIconBaseStyle" BasedOn="{StaticResource ButtonBaseBaseStyle}" TargetType="RadioButton">
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0}"/> <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisualRadius0}" />
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/> <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}" />
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/> <Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="hc:BorderElement.CornerRadius" Value="0"/> <Setter Property="hc:BorderElement.CornerRadius" Value="0" />
<Setter Property="hc:VisualElement.HighlightBrush" Value="{DynamicResource PrimaryBrush}"/> <Setter Property="hc:VisualElement.HighlightBrush" Value="{DynamicResource PrimaryBrush}" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="RadioButton"> <ControlTemplate TargetType="RadioButton">
<Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent"> <Border Name="BorderHighlight" BorderThickness="3,0,0,0" BorderBrush="Transparent">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}"/> <Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{TemplateBinding Foreground}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
<ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> <ContentPresenter x:Name="ContentPresenterMain" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</StackPanel> </StackPanel>
</Border> </Border>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="Content" Value="{x:Null}"> <Trigger Property="Content" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain"/> <Setter Property="Visibility" Value="Collapsed" TargetName="ContentPresenterMain" />
</Trigger> </Trigger>
<Trigger Property="hc:IconElement.Geometry" Value="{x:Null}"> <Trigger Property="hc:IconElement.Geometry" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PathMain" />
<Setter Property="Margin" Value="0" TargetName="ContentPresenterMain"/> <Setter Property="Margin" Value="0" TargetName="ContentPresenterMain" />
</Trigger> </Trigger>
<Trigger Property="IsChecked" Value="True"> <Trigger Property="IsChecked" Value="True">
<Setter Property="BorderBrush" Value="{Binding Path=(hc:VisualElement.HighlightBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderHighlight"/> <Setter Property="BorderBrush" Value="{Binding Path=(hc:VisualElement.HighlightBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderHighlight" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -180,54 +182,54 @@
</Setter> </Setter>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Opacity" Value=".9"/> <Setter Property="Opacity" Value=".9" />
</Trigger> </Trigger>
<Trigger Property="IsPressed" Value="True"> <Trigger Property="IsPressed" Value="True">
<Setter Property="Opacity" Value=".6"/> <Setter Property="Opacity" Value=".6" />
</Trigger> </Trigger>
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/> <Setter Property="Opacity" Value="0.4" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>
<Style x:Key="RadioGroupItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="RadioButton"> <Style x:Key="RadioGroupItemBaseStyle" BasedOn="{StaticResource BaseStyle}" TargetType="RadioButton">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/> <Setter Property="Background" Value="{DynamicResource RegionBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/> <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}" />
<Setter Property="BorderThickness" Value="1"/> <Setter Property="BorderThickness" Value="1" />
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="hc:BorderElement.CornerRadius" Value="0"/> <Setter Property="hc:BorderElement.CornerRadius" Value="0" />
<Setter Property="Height" Value="{StaticResource DefaultControlHeight}"/> <Setter Property="Height" Value="{StaticResource DefaultControlHeight}" />
<Setter Property="Padding" Value="10,0"/> <Setter Property="Padding" Value="10,0" />
<Setter Property="Margin" Value="-1,0,0,0"/> <Setter Property="Margin" Value="-1,0,0,0" />
<Setter Property="hc:IconElement.Width" Value="16"/> <Setter Property="hc:IconElement.Width" Value="16" />
<Setter Property="hc:IconElement.Height" Value="16"/> <Setter Property="hc:IconElement.Height" Value="16" />
<Setter Property="Template"> <Setter Property="Template">
<Setter.Value> <Setter.Value>
<ControlTemplate TargetType="RadioButton"> <ControlTemplate TargetType="RadioButton">
<Border x:Name="BorderRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"> <Border x:Name="BorderRoot" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}"> <StackPanel Orientation="Horizontal" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="{TemplateBinding Padding}">
<Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{Binding Path=(TextElement.Foreground),ElementName=contentPresenter}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}"/> <Path x:Name="PathMain" Height="{Binding Path=(hc:IconElement.Height),RelativeSource={RelativeSource TemplatedParent}}" Width="{Binding Path=(hc:IconElement.Width),RelativeSource={RelativeSource TemplatedParent}}" Fill="{Binding Path=(TextElement.Foreground),ElementName=contentPresenter}" SnapsToDevicePixels="True" Stretch="Uniform" Data="{TemplateBinding hc:IconElement.Geometry}" />
<ContentPresenter x:Name="contentPresenter" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/> <ContentPresenter x:Name="contentPresenter" RecognizesAccessKey="True" VerticalAlignment="Center" Margin="6,0,0,0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
</StackPanel> </StackPanel>
</Border> </Border>
<ControlTemplate.Triggers> <ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter"/> <Setter Property="TextElement.Foreground" Value="{DynamicResource PrimaryBrush}" TargetName="contentPresenter" />
</Trigger> </Trigger>
<Trigger Property="IsChecked" Value="true"> <Trigger Property="IsChecked" Value="true">
<Setter Property="BorderBrush" Value="{Binding Path=(hc:VisualElement.HighlightBorderBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/> <Setter Property="BorderBrush" Value="{Binding Path=(hc:VisualElement.HighlightBorderBrush),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot" />
<Setter Property="Background" Value="{Binding Path=(hc:VisualElement.HighlightBackground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot"/> <Setter Property="Background" Value="{Binding Path=(hc:VisualElement.HighlightBackground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="BorderRoot" />
<Setter Property="TextElement.Foreground" Value="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter"/> <Setter Property="TextElement.Foreground" Value="{Binding Path=(hc:VisualElement.HighlightForeground),RelativeSource={RelativeSource TemplatedParent}}" TargetName="contentPresenter" />
</Trigger> </Trigger>
<Trigger Property="Content" Value="{x:Null}"> <Trigger Property="Content" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="contentPresenter"/> <Setter Property="Visibility" Value="Collapsed" TargetName="contentPresenter" />
</Trigger> </Trigger>
<Trigger Property="hc:IconElement.Geometry" Value="{x:Null}"> <Trigger Property="hc:IconElement.Geometry" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="PathMain"/> <Setter Property="Visibility" Value="Collapsed" TargetName="PathMain" />
<Setter Property="Margin" Value="0" TargetName="contentPresenter"/> <Setter Property="Margin" Value="0" TargetName="contentPresenter" />
</Trigger> </Trigger>
</ControlTemplate.Triggers> </ControlTemplate.Triggers>
</ControlTemplate> </ControlTemplate>
@@ -235,19 +237,19 @@
</Setter> </Setter>
<Style.Triggers> <Style.Triggers>
<Trigger Property="IsEnabled" Value="False"> <Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.4"/> <Setter Property="Opacity" Value="0.4" />
</Trigger> </Trigger>
<Trigger Property="IsChecked" Value="True"> <Trigger Property="IsChecked" Value="True">
<Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}"/> <Setter Property="Panel.ZIndex" Value="{x:Static system:Int32.MaxValue}" />
</Trigger> </Trigger>
<DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource AncestorType=hc:ButtonGroup}}" Value="Vertical"> <DataTrigger Binding="{Binding Orientation,RelativeSource={RelativeSource AncestorType=hc:ButtonGroup}}" Value="Vertical">
<Setter Property="Margin" Value="0,-1,0,0"/> <Setter Property="Margin" Value="0,-1,0,0" />
</DataTrigger> </DataTrigger>
<Trigger Property="IsMouseOver" Value="True"> <Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}"/> <Setter Property="Background" Value="{DynamicResource SecondaryRegionBrush}" />
</Trigger> </Trigger>
<Trigger Property="IsPressed" Value="True"> <Trigger Property="IsPressed" Value="True">
<Setter Property="Background" Value="{DynamicResource BorderBrush}"/> <Setter Property="Background" Value="{DynamicResource BorderBrush}" />
</Trigger> </Trigger>
</Style.Triggers> </Style.Triggers>
</Style> </Style>