当前位置:网站首页>WPF RadioButton style (1)
WPF RadioButton style (1)
2022-07-20 19:15:00 【Brother Xiaohui】
Interface
<RadioButton x:Name="radioButton" IsChecked="True" Content=" Interface " HorizontalAlignment="Left" Height="90" Margin="100,334,0,0" VerticalAlignment="Top" Width="60" Style="{DynamicResource RadioButtonOISStyle}"/>
<RadioButton x:Name="radioButton_Copy" Content=" User management " HorizontalAlignment="Right" Height="90" Margin="0,334,100,0" VerticalAlignment="Top" Width="70" Style="{DynamicResource RadioButtonAdminStyle}"/>
style
<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>
<!-- The background color transparency Frame radian -->
<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" />
<!-- The font color , font size -->
<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=""/>
<!-- Mouse click trigger , The background color -->
<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>
<!-- The background color transparency Frame radian -->
<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" />
<!-- The font color , font size -->
<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=""/>
<!-- Mouse click trigger , The background color -->
<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>
边栏推荐
猜你喜欢
Kyligence李栋:从数据湖到指标中台,提升数据分析ROI
WPF MVVM下 关闭窗体 并打开新窗体
查询端口占用 并关闭
Invalid values in MATLAB fill image
Draw scatter density diagram with MATLAB
安装SQL Server 2012过程中出现“启用windows功能NetFx3时出错”(错误原因、详细分析及解决方法)以及在Windows Server2012上安装.NET Framework 3
Map and set
%d,%s,%c,%x
Interviewer: what are the three cache update strategies of redis & MySQL?
Curd of odoo basic development (add, delete, check, change)
随机推荐
Lidar data download steps
银行理财收益越来越低,现在哪些理财产品收益高?
百度贴吧爬虫获取网页
获取当前文件夹所有文件名
MATLAB实现LMDI分解方法(含零值处理)
Set the database transaction isolation level
Matlab regression analysis obtains the coefficient, P value and R2 of predictive variables (only one line of code)
用户名枚举漏洞怎么解决
TRMM降水数据下载步骤
Curd of odoo basic development (add, delete, check, change)
ArcGIS custom coordinate system (taking Albers as an example)
WPF DataGrid 两行一个颜色
地学学术资源II
MATLAB realizes the distance method of superior and inferior solution (TOPSIS method)
%d,%s,%c,%x
Arcpy batch conversion data projection (taking Albers as an example)
Essential skills of data query SQL tuning: under what circumstances does MySQL not go through the index
云上机器CLOSE_WAIT过多的原因和解决办法
The industry's first "best practice map of live video technology" was released!
地学学术资源III(区划数据)