禁用包含WPF中的groupBox名称的groupBox
我有一个groupBox名称“groupBox”。我想禁用整个groupbox,包括组框的名称。 我正在附上图像。我希望它能清除这种情况
OP1 OP2
我正在使用IsEnabled =“False”属性。 但它只能处理groupBox的内容(如果我错了,请给我看看!)现在我希望圈区也应该禁用。
一个简单的Trigger
可以在XAML中为您完成此操作(不需要任何代码):
OP1 OP2
只需使用触发器
OP1 OP2
你可以改变颜色:
您可以使用转换器更改颜色:
...
转换器代码
public class BrushColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if ((bool)value) { { return System.Windows.Media.Colors.Gray; } } return System.Windows.Media.Colors.Black; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { throw new NotImplementedException(); } }