28 March 2017

Windows Store và Controls: CheckBox IsChecked IsThreeState trên Windows Store C#

MainPage.xaml.cs
Windows Store 2017
private async void button_Click(object sender, RoutedEventArgs e)
{
    MessageDialog dialog = null;
    if (checkBox.IsChecked == true)
    {
        dialog = new MessageDialog("State: True");
    }
    else if (checkBox.IsChecked == null)
    {
        dialog = new MessageDialog("State: Null");
    }
    else if (checkBox.IsChecked == false)
    {
        dialog = new MessageDialog("State: false");
    }
    if (dialog != null)
        await dialog.ShowAsync();
}
MainPage.xaml
Windows Store 2017
<CheckBox x:Name="checkBox" IsThreeState="True" Content="CheckBox" HorizontalAlignment="Left" Margin="490,395,0,0" VerticalAlignment="Top"/>
Run test

0 nhận xét:

Post a Comment

 

BACK TO TOP

Xuống cuối trang