|
- <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>
|