| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395 |
- <ResourceDictionary
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:UI="clr-namespace:CustomUI">
- <SolidColorBrush x:Key="Border.Normal.Color">#C9D2D4</SolidColorBrush>
- <SolidColorBrush x:Key="Border.MouseOver.Color">#6452A4</SolidColorBrush>
- <SolidColorBrush x:Key="IsChecked.Background">#6452A4</SolidColorBrush>
- <SolidColorBrush x:Key="OptionMark.Static.Background" Color="#FFFFFFFF" />
- <SolidColorBrush x:Key="OptionMark.Static.Border" Color="#D7DDE4" />
- <SolidColorBrush x:Key="OptionMark.MouseOver.Background" Color="#FFF3F9FF" />
- <SolidColorBrush x:Key="OptionMark.MouseOver.Border" Color="#6452A4" />
- <SolidColorBrush x:Key="OptionMark.MouseOver.Glyph" Color="#FF212121" />
- <SolidColorBrush x:Key="OptionMark.Disabled.Background" Color="#FFE6E6E6" />
- <SolidColorBrush x:Key="OptionMark.Disabled.Border" Color="#FFBCBCBC" />
- <SolidColorBrush x:Key="OptionMark.Disabled.Glyph" Color="#FF707070" />
- <SolidColorBrush x:Key="OptionMark.Pressed.Background" Color="#FFD9ECFF" />
- <SolidColorBrush x:Key="OptionMark.Pressed.Border" Color="#6452A4" />
- <SolidColorBrush x:Key="OptionMark.Pressed.Glyph" Color="#FF212121" />
- <SolidColorBrush x:Key="OptionMark.Static.Glyph" Color="#FFFFFF" />
- <PathGeometry x:Key="Icon_Checked" Figures="M403.738809 825.236074c-10.027377 0-20.049638-4.052293-27.698852-12.156878L80.563362 500.022201c-15.300474-16.20917-15.300474-42.484603 0-58.69275 15.297404-16.208147 40.098253-16.208147 55.395658 0l267.779789 283.711644 489.358327-518.445806c15.298428-16.210193 40.10337-16.210193 55.402821 0 15.292288 16.207124 15.292288 42.484603-0.00614 58.690704l-517.056156 547.793204C423.788447 821.183781 413.76107 825.236074 403.738809 825.236074L403.738809 825.236074zM403.738809 825.236074" />
- <PathGeometry x:Key="Icon_对勾" Figures="M498.337684 793.195789 194.937263 479.797895 256 498.526316l215.578947 80.842105c71.895579-86.824421 183.996632-240.235789 404.210526-377.263158l53.894737-26.947368C727.552 363.708632 550.777263 657.515789 498.337684 793.195789L498.337684 793.195789 498.337684 793.195789zM881.448421 450.991158c3.233684 19.860211 4.985263 40.232421 4.985263 61.008842 0 206.794105-167.639579 374.433684-374.433684 374.433684-206.767158 0-374.406737-167.639579-374.406737-374.433684 0-206.767158 167.639579-374.406737 374.406737-374.406737 49.960421 0 97.549474 9.781895 141.096421 27.540211l0-74.913684C607.797895 75.048421 560.478316 67.368421 512 67.368421c-59.984842 0-118.218105 11.776-173.082947 34.950737-52.951579 22.420211-100.486737 54.487579-141.312 95.258947-40.798316 40.825263-72.865684 88.333474-95.258947 141.338947C79.144421 393.781895 67.368421 451.988211 67.368421 512s11.776 118.245053 34.977684 173.109895c22.420211 52.951579 54.460632 100.486737 95.258947 141.312 40.825263 40.798316 88.360421 72.838737 141.312 95.258947C393.781895 944.855579 452.015158 956.631579 512 956.631579c60.011789 0 118.272-11.776 173.109895-34.950737 52.951579-22.420211 100.486737-54.460632 141.285053-95.258947 40.825263-40.825263 72.865684-88.360421 95.258947-141.312C944.882526 630.245053 956.631579 572.011789 956.631579 512c0-20.560842-1.374316-40.906105-4.122947-61.008842L881.448421 450.991158 881.448421 450.991158z" />
- <ControlTemplate x:Key="DefaultSquare" TargetType="{x:Type UI:FlatCheckBox}">
- <Grid
- x:Name="templateRoot"
- Background="Transparent"
- SnapsToDevicePixels="True">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Border
- x:Name="checkBoxBorder"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="2">
- <Grid x:Name="markGrid">
- <Border
- x:Name="borderMark"
- Background="{TemplateBinding CheckedColor}"
- CornerRadius="1"
- SnapsToDevicePixels="True"
- UseLayoutRounding="True" />
- <Path
- x:Name="optionMark"
- Width="12"
- Height="{Binding Width, RelativeSource={RelativeSource Self}}"
- Margin="1"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Data="M329.625346 860.782661 17.275455 548.433794 74.584696 491.124554 329.625346 746.165204 949.415304 126.374222 1006.724545 183.683463Z"
- Fill="{StaticResource OptionMark.Static.Glyph}"
- RenderTransformOrigin="0.5,0.5"
- Stretch="Uniform">
- <Path.RenderTransform>
- <TransformGroup>
- <ScaleTransform />
- <SkewTransform />
- <RotateTransform />
- <TranslateTransform />
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- <Rectangle
- x:Name="indeterminateMark"
- Margin="2"
- Fill="{StaticResource OptionMark.Static.Glyph}"
- RenderTransformOrigin="0.5,0.5">
- <Rectangle.RenderTransform>
- <TransformGroup>
- <ScaleTransform />
- <SkewTransform />
- <RotateTransform />
- <TranslateTransform />
- </TransformGroup>
- </Rectangle.RenderTransform>
- </Rectangle>
- </Grid>
- </Border>
- <ContentPresenter
- x:Name="contentPresenter"
- Grid.Column="1"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Focusable="False"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- <VisualStateManager.VisualStateGroups>
- <VisualStateGroup x:Name="CheckStates">
- <VisualState x:Name="Checked">
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetName="optionMark"
- Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
- From="0.2"
- To="1"
- Duration="0:0:0.2" />
- <DoubleAnimation
- Storyboard.TargetName="optionMark"
- Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
- From="0.2"
- To="1"
- Duration="0:0:0.2" />
- <ColorAnimation
- Storyboard.TargetName="borderMark"
- Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
- From="Transparent"
- To="#6452A4"
- Duration="0:0:0.2" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Unchecked">
- <Storyboard>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="optionMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
- <EasingDoubleKeyFrame KeyTime="0" Value="1" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.2" />
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="optionMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
- <EasingDoubleKeyFrame KeyTime="0" Value="1" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.2" />
- </DoubleAnimationUsingKeyFrames>
- <ColorAnimation
- Storyboard.TargetName="borderMark"
- Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
- From="#3399FF"
- To="Transparent"
- Duration="0:0:0.2" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Indeterminate">
- <Storyboard>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="indeterminateMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
- <EasingDoubleKeyFrame KeyTime="0" Value="0" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="indeterminateMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
- <EasingDoubleKeyFrame KeyTime="0" Value="0" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="HasContent" Value="true">
- <Setter Property="Padding" Value="4,0,0,0" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="checkBoxBorder" Property="BorderBrush" Value="{StaticResource OptionMark.MouseOver.Border}" />
- <Setter TargetName="indeterminateMark" Property="Fill" Value="{StaticResource OptionMark.MouseOver.Glyph}" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Cursor" Value="No" />
- <Setter TargetName="checkBoxBorder" Property="Background" Value="{StaticResource OptionMark.Disabled.Background}" />
- <Setter TargetName="checkBoxBorder" Property="BorderBrush" Value="{StaticResource OptionMark.Disabled.Border}" />
- <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource OptionMark.Disabled.Glyph}" />
- <Setter TargetName="indeterminateMark" Property="Fill" Value="{StaticResource OptionMark.Disabled.Glyph}" />
- </Trigger>
- <Trigger Property="IsPressed" Value="true">
- <!--<Setter TargetName="checkBoxBorder" Property="BorderBrush" Value="{StaticResource OptionMark.Pressed.Border}" />-->
- <Setter TargetName="indeterminateMark" Property="Fill" Value="{StaticResource OptionMark.Pressed.Glyph}" />
- </Trigger>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="optionMark" Property="Opacity" Value="1" />
- <Setter TargetName="indeterminateMark" Property="Opacity" Value="0" />
- <Setter TargetName="checkBoxBorder" Property="BorderBrush" Value="{StaticResource OptionMark.MouseOver.Border}" />
- </Trigger>
- <Trigger Property="IsChecked" Value="false">
- <Setter TargetName="indeterminateMark" Property="Opacity" Value="0" />
- </Trigger>
- <Trigger Property="IsChecked" Value="{x:Null}">
- <Setter TargetName="optionMark" Property="Opacity" Value="0" />
- <Setter TargetName="borderMark" Property="Opacity" Value="0" />
- <Setter TargetName="indeterminateMark" Property="Opacity" Value="1" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <ControlTemplate x:Key="DefaultEllipse" TargetType="{x:Type UI:FlatCheckBox}">
- <Grid
- x:Name="templateRoot"
- Background="Transparent"
- SnapsToDevicePixels="True">
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="Auto" />
- <ColumnDefinition Width="*" />
- </Grid.ColumnDefinitions>
- <Border
- x:Name="borderMark"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Background="{TemplateBinding Background}"
- BorderBrush="{TemplateBinding BorderBrush}"
- BorderThickness="{TemplateBinding BorderThickness}"
- CornerRadius="100">
- <Path
- x:Name="optionMark"
- Width="12"
- Height="{Binding Width, RelativeSource={RelativeSource Self}}"
- Margin="2"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Data="M329.625346 860.782661 17.275455 548.433794 74.584696 491.124554 329.625346 746.165204 949.415304 126.374222 1006.724545 183.683463Z"
- Fill="{StaticResource OptionMark.Static.Glyph}"
- RenderTransformOrigin="0.5,0.5"
- Stretch="Uniform">
- <Path.RenderTransform>
- <TransformGroup>
- <ScaleTransform />
- <SkewTransform />
- <RotateTransform />
- <TranslateTransform />
- </TransformGroup>
- </Path.RenderTransform>
- </Path>
- </Border>
- <ContentPresenter
- x:Name="contentPresenter"
- Grid.Column="1"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Focusable="False"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- <VisualStateManager.VisualStateGroups>
- <!--<VisualStateGroup x:Name="CommonStates">
- <VisualState x:Name="Normal">
- <Storyboard>
- <ColorAnimation Storyboard.TargetName="borderMark"
- Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
- Duration="00:00:0.3" To="#D7DDE4"/>
- </Storyboard>
- </VisualState>
- <VisualState x:Name="MouseOver">
- <Storyboard>
- <ColorAnimation Storyboard.TargetName="borderMark"
- Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
- Duration="00:00:0.3" To="#3399FF"/>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>-->
- <VisualStateGroup x:Name="CheckStates">
- <VisualState x:Name="Checked">
- <Storyboard>
- <DoubleAnimation
- Storyboard.TargetName="optionMark"
- Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)"
- From="0.2"
- To="1"
- Duration="0:0:0.2" />
- <DoubleAnimation
- Storyboard.TargetName="optionMark"
- Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)"
- From="0.2"
- To="1"
- Duration="0:0:0.2" />
- <ColorAnimation
- Storyboard.TargetName="borderMark"
- Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
- From="Transparent"
- To="#3399FF"
- Duration="0:0:0.2" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Unchecked">
- <Storyboard>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="optionMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
- <EasingDoubleKeyFrame KeyTime="0" Value="1" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.2" />
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="optionMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
- <EasingDoubleKeyFrame KeyTime="0" Value="1" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0.2" />
- </DoubleAnimationUsingKeyFrames>
- <ColorAnimation
- Storyboard.TargetName="borderMark"
- Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
- From="#3399FF"
- To="Transparent"
- Duration="0:0:0.2" />
- </Storyboard>
- </VisualState>
- <VisualState x:Name="Indeterminate">
- <Storyboard>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="indeterminateMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)">
- <EasingDoubleKeyFrame KeyTime="0" Value="0" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
- </DoubleAnimationUsingKeyFrames>
- <DoubleAnimationUsingKeyFrames Storyboard.TargetName="indeterminateMark" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)">
- <EasingDoubleKeyFrame KeyTime="0" Value="0" />
- <EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1" />
- </DoubleAnimationUsingKeyFrames>
- </Storyboard>
- </VisualState>
- </VisualStateGroup>
- </VisualStateManager.VisualStateGroups>
- </Grid>
- <ControlTemplate.Triggers>
- <Trigger Property="HasContent" Value="true">
- <Setter Property="Padding" Value="4,0,0,0" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="borderMark" Property="BorderBrush" Value="{StaticResource OptionMark.MouseOver.Border}" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Cursor" Value="No" />
- <Setter TargetName="borderMark" Property="Background" Value="{StaticResource OptionMark.Disabled.Background}" />
- <Setter TargetName="borderMark" Property="BorderBrush" Value="{StaticResource OptionMark.Disabled.Border}" />
- <Setter TargetName="optionMark" Property="Fill" Value="{StaticResource OptionMark.Disabled.Glyph}" />
- </Trigger>
- <Trigger Property="IsPressed" Value="true">
- <Setter TargetName="borderMark" Property="BorderBrush" Value="{StaticResource OptionMark.Pressed.Border}" />
- </Trigger>
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="optionMark" Property="Opacity" Value="1" />
- <Setter TargetName="borderMark" Property="BorderBrush" Value="#6452A4" />
- </Trigger>
- <Trigger Property="IsChecked" Value="{x:Null}">
- <Setter TargetName="optionMark" Property="Opacity" Value="0" />
- <Setter TargetName="borderMark" Property="Opacity" Value="0" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <ControlTemplate x:Key="EllipseSkin1" TargetType="{x:Type UI:FlatCheckBox}">
- <!-- 使用BulletDecorator可以解决CheckBox样式重写后只能点击文字或者边缘才能选中CheckBox的问题 -->
- <BulletDecorator VerticalAlignment="Center" Background="Transparent">
- <BulletDecorator.Bullet>
- <Path
- x:Name="cp"
- Width="18"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Data="{StaticResource Icon_对勾}"
- Fill="{TemplateBinding UnCheckedColor}"
- SnapsToDevicePixels="True"
- Stretch="Uniform"
- UseLayoutRounding="True" />
- </BulletDecorator.Bullet>
- <ContentPresenter
- Margin="5,0,0,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center" />
- </BulletDecorator>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="True">
- <Setter Property="Cursor" Value="Hand" />
- </Trigger>
- <Trigger Property="IsChecked" Value="True">
- <Setter TargetName="cp" Property="Fill" Value="{Binding CheckedColor, RelativeSource={RelativeSource TemplatedParent}}" />
- </Trigger>
- <Trigger Property="IsEnabled" Value="False">
- <Setter Property="Cursor" Value="No" />
- <Setter TargetName="cp" Property="Fill" Value="#DDDBD5" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- <Style TargetType="{x:Type UI:FlatCheckBox}">
- <Setter Property="Background" Value="{StaticResource OptionMark.Static.Background}" />
- <Setter Property="BorderBrush" Value="{StaticResource OptionMark.Static.Border}" />
- <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" />
- <Setter Property="BorderThickness" Value="1" />
- <Setter Property="VerticalContentAlignment" Value="Center" />
- <Setter Property="SnapsToDevicePixels" Value="True" />
- <Setter Property="UseLayoutRounding" Value="True" />
- <Setter Property="UnCheckedColor" Value="{StaticResource Border.Normal.Color}" />
- <Setter Property="CheckedColor" Value="{StaticResource IsChecked.Background}" />
- <Setter Property="Template" Value="{StaticResource DefaultSquare}" />
- <Style.Triggers>
- <Trigger Property="Skins" Value="DefaultEllipse">
- <Setter Property="Template" Value="{StaticResource DefaultEllipse}" />
- </Trigger>
- <Trigger Property="Skins" Value="EllipseSkin1">
- <Setter Property="UnCheckedColor" Value="#D9D9D9" />
- <Setter Property="CheckedColor" Value="#ED5435" />
- <Setter Property="Template" Value="{StaticResource EllipseSkin1}" />
- </Trigger>
- </Style.Triggers>
- </Style>
- </ResourceDictionary>
|