根据复选框状态启用或禁用组框 [英] Enable or Disable Group box based on Check box State
问题描述
大家好,
以下摘录是从ABCProduct.xaml中提取的,用于WPF应用程序.
< GroupBox Header ="NewType" name ="Typ1" Grid.Row ="2" BorderBrush ="Gray" BorderThickness ="1">
< CheckBox名称="ProductCheckBox"> Prod.CheckBox</CheckBox>
</GroupBox>
< GroupBox Header ="SWG_ProductType" name =< b>"{{BindingElementName = Typ1,Path = IsChecked}"></b> Grid.Row ="3" ...>
......
......其他控件<!-<即浏览器,单选按钮等--
......
</GroupBox>
未找到错误为"BindingElementName".要验证缺少的程序集引用",等等,
使用绑定复选框和Path = IsChecked的元素名称来绑定Group Box控件"的工作正在XAML解析器中给出错误,您能否建议我们如何实现相同的功能?
即,我们如何禁用或启用组框<<< SWG_ProductType>>复选框状态为基础的实体.
在此先感谢...
问候,
Samanth
Hi All,
The following snippet is extracted from ABCProduct.xaml, for WPF Application.
<GroupBox Header="NewType" name="Typ1" Grid.Row="2" BorderBrush="Gray" BorderThickness="1">
<CheckBox Name="ProductCheckBox">Prod.CheckBox</CheckBox>
</GroupBox>
<GroupBox Header="SWG_ProductType" name=<b>"{BindingElementName=Typ1,Path =IsChecked}"></b> Grid.Row="3" ...>
......
......other Controls <!-<<viz., Radio Buttons etc., -->
......
</GroupBox>
"The Error is "BindingElementName" was not found. To verify missing assembly reference" etc.,
The work around for Binding the Group Box controls using "Binding Element Name for Check box and Path= IsChecked is giving error in XAML parser, could you suggest how could we implement the same.
ie., How can we disable or enable the Group Box <<SWG_ProductType>> entities based on Check box State.
Thanks in Advance...
With Regards,
Samanth
推荐答案
您有2个错误:
You have 2 mistakes:
- 您忘记在
Binding
和ElementName
之间放置空格. - 您使用了
Name
属性而不是IsEnabled
属性.
- You forgot to put a space between
Binding
andElementName
. - You used the
Name
property instead of theIsEnabled
property.
您可以将GroupBox
的定义更改为以下内容:
You can change the definition of your GroupBox
to something like the following:
<GroupBox Header="SWG_ProductType" IsEnabled="{Binding ElementName=Typ1, Path =IsChecked}" Grid.Row="3" ...>
这篇关于根据复选框状态启用或禁用组框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!