繁体   English   中英

检查Radiobutton已经改变了WPF

[英]Radiobutton checked has changed WPF

在我的WPF应用程序中,我有:

- > TextBox(textChanged)

- > 2个单选按钮

- >包含内容的ListView。 “作者”,“标题”。

我需要允许从Listview中搜索。

我的问题是:我应该如何检查radiobutton检查是否改变了?

正如评论中所提到的,MVVM首选WPF,然后绑定到IsChecked属性。

private bool _RadioButtonChecked;
public bool RadioButtonChecked
{
    get => _RadioButtonChecked;
    set
    {
        _RadioButtonChecked = value;
        //Refresh filter here
    }
}

Xaml绑定:

<RadioButton Content="RadioButton" IsChecked="{Binding RadioButtonChecked}"/>

除此之外,还有可以使用的CheckedUnChecked事件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM