当前位置:网站首页>【WPF】利用RadioButton制作导航条
【WPF】利用RadioButton制作导航条
2022-04-21 06:34:00 【阿月浑子2021】

<Window x:Class="WpfApp1.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<Style x:Key="defaultRadioStyle" TargetType="RadioButton">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Foreground" Value="Green"/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="FocusVisualStyle" Value="{x:Null}"/>
<Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="RadioButton">
<Grid Background="{TemplateBinding Background}">
<Border x:Name="_border" BorderBrush="{TemplateBinding Foreground}" BorderThickness="0" />
<ContentPresenter Focusable="True" RecognizesAccessKey="True"
VerticalAlignment="{TemplateBinding VerticalAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Margin="{TemplateBinding Margin}"/>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="True">
<Setter Property="Foreground" Value="Red"/>
<Setter Property="BorderThickness" Value="0 0 0 1" TargetName="_border"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<Grid>
<UniformGrid Columns="4" Height="40" Width="300">
<RadioButton Style="{StaticResource defaultRadioStyle}">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="" FontSize="18" FontFamily="/Fonts/#iconfont" VerticalAlignment="Center"/>
<TextBlock Text="主界面" Margin="6 0 0 0" VerticalAlignment="Center"/>
</StackPanel>
</RadioButton>
<RadioButton Style="{StaticResource defaultRadioStyle}">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="" FontSize="18" FontFamily="/Fonts/#iconfont" VerticalAlignment="Center"/>
<TextBlock Text="改进" Margin="6 0 0 0" VerticalAlignment="Center"/>
</StackPanel>
</RadioButton>
<RadioButton Style="{StaticResource defaultRadioStyle}">
<StackPanel Orientation="Horizontal" Height="35">
<TextBlock Text="" FontSize="18" FontFamily="/Fonts/#iconfont" VerticalAlignment="Center"/>
<TextBlock Text="评价" Margin="6 0 0 0" VerticalAlignment="Center"/>
</StackPanel>
</RadioButton>
</UniformGrid>
</Grid>
</Window>

版权声明
本文为[阿月浑子2021]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_56814032/article/details/122079734
边栏推荐
- Nodered connection database
- Domestic first USBhub Daquan, USB hub2 0,HUB3. 0, Wangjiu prolific, pl2586, ma8601, and xinrunde SL2 2A、SL2. 2s, replace Tang Ming's Fe1 1、FE1. 1s,, Weifeng vl810
- Using Wireshark to restore pcap data stream to picture file
- BGP 鄰居
- Database requirement analysis of online ordering system
- Basic concepts of IP Multicast
- MS1836S,HDMI转CVBS,视频转换器,HDMI接收器,内置 MCU 和存储器
- 三层交换机与路由器对接上网
- Knowledge of classes and objects
- 光华芯音频Codec大全CJC4344、CJC8988、CJC5340、CJC6811光华芯音频codec、CJC4344、CJC8988、替换顺芯ES8388、替换cs5340
猜你喜欢

Ms12 020 vulnérabilité

BGP 邻居

Detailed explanation of the whole evolution process and architecture design of large websites

RTSP unauthorized access

Cs5801 specification | cs5801 HDMI to EDP conversion scheme | HDMI to DP adapter board design, hdmi2 0 turn edp1 4. Support downward compatibility

类和对象的相关知识

信息加密与信息摘要

2020-12-25

龙讯系列视频转换,LT9211、LT8918,功能:lvds转BT656,lvds转mipi(CSI\DSI)RGB转MIPI(DSI\CSI) BT656\601\1120转HDMI1.4\DVI

dos命令杀死进程
随机推荐
Nmap扫描和Scapy项目
Blue Bridge Cup -- conversion between hexadecimal and decimal
Ruiyuan ry8132 and ry9140 DCDC are mainly replaced by tps563200 and tps563201 of Ti, mp1471 and mp1653 of Xinyuan, and details of sy8104 power chip of silijie
NP、OSPF邻居邻接关系
Huatian OA vulnerability reproduction manual
Use Baidu map POI to crawl the required data
排序方式(2)==>插入排序
BGP authentication function
【计组】性能
BGP 鄰居
类和对象的相关知识
NP、OSPF Stub区域
国产POE,RPC304,替换IP802、IP804、IP808,替换TPS23861、LTC4292、PD69204、SI3459,国产首发POE供电、PSE,睿普康国产以太网供电及接口转换芯片
有关imap-tools模块实现邮件移动的问题
Sort method (2) = > insert sort
Knowledge of classes and objects
网上订餐系统数据库需求分析
【WPF】Popup
配置mysql远程访问
Jfinal hutool tool excel util ziputil realizes exporting excel and compressing files