|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
- <!--#region 编辑开关 ToggleButton 样式-->
- <Style x:Key="EditToggleButtonStyle" TargetType="{x:Type ToggleButton}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <Grid>
- <Border
- x:Name="border2"
- Width="{TemplateBinding Width}"
- Height="{TemplateBinding Height}"
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Background="Transparent">
- <ContentPresenter
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
- </Grid>
-
- <ControlTemplate.Triggers>
- <!--<Trigger Property="IsPressed" Value="true">
- <Setter Property="Background" Value="#FFd2e7f4" />
- </Trigger>-->
-
- <!-- 控件选中 -->
- <Trigger Property="IsChecked" Value="true">
- <Setter Property="Foreground" Value="#ff1002E9" />
- </Trigger>
-
- <!-- 控件未选中 -->
- <Trigger Property="IsChecked" Value="false">
- <Setter Property="Foreground" Value="#ff2AB2E7" />
- </Trigger>
-
- <!-- 鼠标进入 -->
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="border2" Property="Background" Value="#332AB2E7" />
- </Trigger>
-
- <!-- 控件禁用 -->
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Foreground" Value="#662AB2E7" />
- </Trigger>
-
- <!-- 控件启用 -->
- <Trigger Property="IsEnabled" Value="True">
- <Setter Property="Foreground" Value="#ff2AB2E7" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 切换开关 ToggleButton 样式-->
- <Style x:Key="SwitchToggleButtonStyle" TargetType="{x:Type ToggleButton}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <Viewbox>
- <Grid x:Name="gr" Opacity="0.8">
- <Border
- x:Name="border2"
- Width="{TemplateBinding Width}"
- Height="{TemplateBinding Height}"
- HorizontalAlignment="Left"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Background="Red"
- BorderBrush="{TemplateBinding BorderBrush}"
- CornerRadius="15">
- <ContentPresenter
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
- </Border>
-
- <Ellipse
- Name="ell"
- Width="{TemplateBinding Height}"
- Height="{TemplateBinding Height}"
- Margin="0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Fill="#ddd" />
-
- <TextBlock
- Name="tb"
- Margin="10,0,10,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="White"
- Text="开" />
-
- </Grid>
- </Viewbox>
- <ControlTemplate.Triggers>
- <!-- 控件选中 -->
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="ell" Property="HorizontalAlignment" Value="Right" />
- <Setter TargetName="border2" Property="Background" Value="#00c2f4" />
- <Setter TargetName="tb" Property="Text" Value="关" />
- <Setter TargetName="tb" Property="Margin" Value="0,0,15,0" />
- </Trigger>
-
- <!-- 控件未选中 -->
- <Trigger Property="IsChecked" Value="false">
- <Setter TargetName="border2" Property="Background" Value="gray" />
- <Setter TargetName="tb" Property="Text" Value="开" />
- <Setter TargetName="tb" Property="Margin" Value="15,0,0,0" />
- </Trigger>
-
- <!-- 鼠标进入 -->
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="gr" Property="Opacity" Value="1" />
- </Trigger>
-
- <!-- 控件禁用 -->
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="gr" Property="Opacity" Value="0.5" />
- </Trigger>
-
- <!-- 控件启用 -->
- <Trigger Property="IsEnabled" Value="True">
- <Setter TargetName="gr" Property="Opacity" Value="0.8" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
-
- <!--#region 切换开关 ToggleButton 样式-->
- <Style x:Key="SwitchToggleButtonStyle1" TargetType="{x:Type ToggleButton}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type ToggleButton}">
- <Viewbox>
- <Grid x:Name="gr" Opacity="0.8">
- <Border
- x:Name="border2"
- Width="{TemplateBinding Width}"
- Height="{TemplateBinding Height}"
- HorizontalAlignment="Left"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- Background="Red"
- BorderBrush="{TemplateBinding BorderBrush}"
- CornerRadius="15">
- <ContentPresenter
- Margin="{TemplateBinding Padding}"
- HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
- VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
- RecognizesAccessKey="True"
- SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
- Visibility="Collapsed" />
- </Border>
-
- <Ellipse
- Name="ell"
- Width="{TemplateBinding Height}"
- Height="{TemplateBinding Height}"
- Margin="0"
- HorizontalAlignment="Left"
- VerticalAlignment="Center"
- Fill="#ddd" />
-
- <TextBlock
- Name="tb"
- Margin="10,0,10,0"
- HorizontalAlignment="Center"
- VerticalAlignment="Center"
- Foreground="White"
- Text="{TemplateBinding Content}" />
-
- </Grid>
- </Viewbox>
- <ControlTemplate.Triggers>
- <!-- 控件选中 -->
- <Trigger Property="IsChecked" Value="true">
- <Setter TargetName="ell" Property="HorizontalAlignment" Value="Right" />
- <Setter TargetName="border2" Property="Background" Value="#00c2f4" />
- <Setter TargetName="tb" Property="Margin" Value="0,0,15,0" />
- </Trigger>
-
- <!-- 控件未选中 -->
- <Trigger Property="IsChecked" Value="false">
- <Setter TargetName="border2" Property="Background" Value="gray" />
- <Setter TargetName="tb" Property="Margin" Value="15,0,0,0" />
- </Trigger>
-
- <!-- 鼠标进入 -->
- <Trigger Property="IsMouseOver" Value="True">
- <Setter TargetName="gr" Property="Opacity" Value="1" />
- </Trigger>
-
- <!-- 控件禁用 -->
- <Trigger Property="IsEnabled" Value="false">
- <Setter TargetName="gr" Property="Opacity" Value="0.5" />
- </Trigger>
-
- <!-- 控件启用 -->
- <Trigger Property="IsEnabled" Value="True">
- <Setter TargetName="gr" Property="Opacity" Value="0.8" />
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <!--#endregion-->
- </ResourceDictionary>
|