In my ViewModel
类我有一个静态属性AllSupport
但我不知道如何正确绑定它。 ListView 已绑定到 ObservableCollectionAllEffects
具有AllSupport
静态属性。
我用过这个:
<GridViewColumn
Width="Auto"
Header="GPU">
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox
Margin="0"
HorizontalAlignment="Center"
IsChecked="{Binding AllSupport[HardwareType].SupportList.IsSupported, Mode=TwoWay}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
AllEffects
is ObservableCollection
of EffectViewModel
它有一个名为的静态属性AllSupport
其类型为:Dictionary<HardwareType, List<EffectSupport>>
where:
HardwareType
是一个枚举,并且EffectSupport
是一个实例类,它有一个名为的布尔属性IsSupported
.
我也尝试过这个,但后来它抱怨找不到IsSupported
on the ViewModel
class:
IsChecked="{Binding AllSupport[HardwareType].SupportList, Path=IsSupported
有什么想法,如何指定这个绑定?
您可以使用x:Static
类是否是静态的以访问静态成员。
未经测试:
IsChecked="{Binding [HardwareType], Source={x:Static prefix:EffectViewModel.AllSupport}}"
你需要一个prefix
访问视图模型的名称空间。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)