界面
1 2 | <RadioButton x:Name="radioButton" IsChecked="True" Content="界面" HorizontalAlignment="Left" Height="90" Margin="100,334,0,0" VerticalAlignment="Top" Width="60" Style="{DynamicResource RadioButtonOISStyle}"/> <RadioButton x:Name="radioButton_Copy" Content="用户管理" HorizontalAlignment="Right" Height="90" Margin="0,334,100,0" VerticalAlignment="Top" Width="70" Style="{DynamicResource RadioButtonAdminStyle}"/> |
样式
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | <Style x:Key="RadioButtonOISStyle" TargetType="{x:Type RadioButton}"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="Background" Value="{StaticResource CheckRadioFillNormal}"/> <Setter Property="BorderBrush" Value="{StaticResource CheckRadioStrokeNormal}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <Grid Margin="0,0,0,-4.11" Width="60" Height="Auto"> <Grid.RowDefinitions> <RowDefinition Height="31*"/> <RowDefinition Height="11*"/> </Grid.RowDefinitions> <!--背景颜色 透明度 边框弧度--> <Rectangle x:Name="rectangle" Fill="{x:Null}" Stroke="{x:Null}" Opacity="1" RadiusX="0" RadiusY="0" StrokeThickness="0" Grid.RowSpan="1"/> <Image x:Name="image" Source="/OIS;component/Resources/Images/oisB.png" Grid.RowSpan="1" Height="Auto" HorizontalAlignment="Center" Width="60" Margin="0,4.5" /> <!--字体颜色, 字体大小--> <TextBlock x:Name="textBlock" Margin="0" TextWrapping="Wrap" Text="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Stretch" Height="22" FontSize="16" Foreground="#FFACADAE" Grid.RowSpan="1" Grid.Row="1" Width="33"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="GroupName" Value=""/> <Trigger Property="GroupName" Value=""/> <!--鼠标点击触发器, 背景颜色--> <Trigger Property="IsChecked" Value="True"> <Setter Property="Opacity" TargetName="rectangle" Value="1"/> <Setter Property="Source" TargetName="image" Value="/OIS;component/Resources/Images/oisA.png"/> <Setter Property="Foreground" TargetName="textBlock" Value="#FF1AB394"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="RadioButtonAdminStyle" TargetType="{x:Type RadioButton}"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="Background" Value="{StaticResource CheckRadioFillNormal}"/> <Setter Property="BorderBrush" Value="{StaticResource CheckRadioStrokeNormal}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <Grid Margin="0,0,0,-4.11" Width="70" Height="Auto"> <Grid.RowDefinitions> <RowDefinition Height="31*"/> <RowDefinition Height="11*"/> </Grid.RowDefinitions> <!--背景颜色 透明度 边框弧度--> <Rectangle x:Name="rectangle" Fill="{x:Null}" Stroke="{x:Null}" Opacity="1" RadiusX="0" RadiusY="0" StrokeThickness="0" Grid.RowSpan="1"/> <Image x:Name="image" Source="/OIS;component/Resources/Images/AdminB.png" Grid.RowSpan="1" Height="Auto" HorizontalAlignment="Center" Width="60" Margin="0,4.5" /> <!--字体颜色, 字体大小--> <TextBlock x:Name="textBlock" Margin="0" TextWrapping="Wrap" Text="{TemplateBinding Content}" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Height="22" FontSize="16" Foreground="#FFACADAE" Grid.RowSpan="1" Grid.Row="1" Width="Auto"/> </Grid> <ControlTemplate.Triggers> <Trigger Property="GroupName" Value=""/> <Trigger Property="GroupName" Value=""/> <!--鼠标点击触发器, 背景颜色--> <Trigger Property="IsChecked" Value="True"> <Setter Property="Opacity" TargetName="rectangle" Value="1"/> <Setter Property="Source" TargetName="image" Value="/OIS;component/Resources/Images/adminA.png"/> <Setter Property="Foreground" TargetName="textBlock" Value="#FF1AB394"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> |