惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Attack and Defense Labs
Attack and Defense Labs
The GitHub Blog
The GitHub Blog
C
Check Point Blog
博客园_首页
MongoDB | Blog
MongoDB | Blog
N
Netflix TechBlog - Medium
F
Full Disclosure
Microsoft Security Blog
Microsoft Security Blog
爱范儿
爱范儿
Recent Announcements
Recent Announcements
阮一峰的网络日志
阮一峰的网络日志
G
GRAHAM CLULEY
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
C
Cybersecurity and Infrastructure Security Agency CISA
V
Vulnerabilities – Threatpost
K
Kaspersky official blog
博客园 - 司徒正美
S
Schneier on Security
T
The Exploit Database - CXSecurity.com
Project Zero
Project Zero
云风的 BLOG
云风的 BLOG
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary
雷峰网
雷峰网
V
V2EX - 技术
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Spread Privacy
Spread Privacy
罗磊的独立博客
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
SecWiki News
SecWiki News
Schneier on Security
Schneier on Security
O
OpenAI News
Jina AI
Jina AI
PCI Perspectives
PCI Perspectives
Cyberwarzone
Cyberwarzone
Y
Y Combinator Blog
Apple Machine Learning Research
Apple Machine Learning Research
B
Blog RSS Feed
I
InfoQ
D
Docker
P
Palo Alto Networks Blog
Recorded Future
Recorded Future
M
MIT News - Artificial intelligence
博客园 - Franky
B
Blog
Scott Helme
Scott Helme
博客园 - 叶小钗
D
DataBreaches.Net

博客园 - 水色天空

用docfx生成c#项目API的简洁教程 wpf datagrid鼠标穿透 OxyPloot设置X轴时间DateTimeAxis WPF中MVVM模式下ComboBox绑定,无法更新selectedItem的解决方案 WPF设置DatePicker日期格式之卡Bug大法 WPF程序自动重启 InstallShield打包.net项目无法包含数据库、配置文件等 handycontrol中NumericUpDown无法显示自定义错误提示的解决办法 DataGrid代码生成列居中问题 Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 9 High-Water Marks Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 9 Missing Message Problem Solver Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 9 Zero-Copy Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 8 Node Coordination Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 6 Multithreading with ZeroMQ - 水色天空 Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 7 Signaling Between Threads (PAIR Sockets) Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 5 Handling Interrupt Signals - 水色天空 解决.net reactor加密后的dll,在其它电脑无法运行的问题 函数返回值的一些规则 Chapter 2 - Sockets and Patterns【选译,哈哈】 Part 4 Handling Errors and ETERM
WPF绑定RadioButton的标准做法
水色天空 · 2021-09-22 · via 博客园 - 水色天空

枚举:

enum EnumRadio
{
  否,是
}

转换器:

 1 [ValueConversion(typeof(EnumRadio), typeof(bool))]
 2     class EnumRadioConverter : IValueConverter
 3     {
 4         public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
 5         {
 6             return value == null ? false : value.Equals(parameter);
 7         }
 8 
 9         public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
10         {
11             return value != null && value.Equals(true) ? parameter : Binding.DoNothing;
12         }
13     }

Xaml:

<model:EnumRadioConverter x:Key="EnumRadioConverter"/>


<RadioButton GroupName="secondLoop" Content="" IsThreeState="False" IsChecked="{Binding HouseConfig.HouseStep2.IsAccumulation, Converter={StaticResource EnumRadioConverter}, ConverterParameter={x:Static model:EnumRadio.是}}" VerticalAlignment="Center"/>
                                            <RadioButton GroupName="secondLoop" Content="" IsThreeState="False" IsChecked="{Binding HouseConfig.HouseStep2.IsAccumulation, Converter={StaticResource EnumRadioConverter}, ConverterParameter={x:Static model:EnumRadio.否}}" VerticalAlignment="Center" Margin="20,0"/>
                                        

引用:https://www.cnblogs.com/xpvincent/p/10267320.html