0

嗨,伙计们,如果未选中相应的单选按钮,我如何将我的文本框只读设置为 true,反之亦然。当相应的按钮也未选中时,与 datepicker、combobox 可聚焦和 ishittestvisible 相同,反之亦然...谢谢

我发现在 wpf c#.. 单选按钮没有 checkchange 属性。仅在winform中...这就是我要做的

    private void rdbtn1_Checked(object sender, RoutedEventArgs e) // <----This must CheckChange
    {
        if (rdbtndatecreated.IsChecked == true)
        {
            textBox1.IsReadOnly = false;
            DatePicker1.Focusable = true;
            DatePicker1.IsHitVisible = true;
        }
        else
        {
            textBox1.IsReadOnly = true;
            DatePicker1.Focusable = false;
            DatePicker1.IsHitVisible = false;
        }
    }
4

1 回答 1

1

您可以分别处理CheckedUnchecked事件。

void rdbtn1_Checked(object sender, RoutedEventArgs e)
{
     textBox1.IsReadOnly = false;
     DatePicker1.Focusable = true;
     DatePicker1.IsHitVisible = true;
}


void rdbtn1_Unchecked(object sender, RoutedEventArgs e)
{    
     textBox1.IsReadOnly = true;
     DatePicker1.Focusable = false;
     DatePicker1.IsHitVisible = false;    
}
于 2012-10-23T01:28:16.860 回答