美文网首页
WPF 中的CheckBox(2)

WPF 中的CheckBox(2)

作者: Ritchie_Li | 来源:发表于2022-06-16 20:48 被阅读0次

选中,没有选择,不确定状态的检查。

<StackPanel Margin="10">

            <CheckBox

            Content="CheckBox"

            HorizontalAlignment="Left"

            Margin="10,10,0,0"

            VerticalAlignment="Top"

            IsThreeState="True"

            Checked="CheckBox_Checked"

            Unchecked="CheckBox_Unchecked"

            Indeterminate="CheckBox_Indeterminate"/>

        </StackPanel>

后台代码:

private void CheckBox_Checked(object sender, RoutedEventArgs e)

        {

            this.Title = "Checked";

        }

        private void CheckBox_Unchecked(object sender, RoutedEventArgs e)

        {

            this.Title = "Unchecked";

        }

        private void CheckBox_Indeterminate(object sender, RoutedEventArgs e)

        {

            this.Title = "Indeterminate";

        }

选中:

没有选中:

不确定状态

相关文章

网友评论

      本文标题:WPF 中的CheckBox(2)

      本文链接:https://www.haomeiwen.com/subject/xaxfvrtx.html