【发布时间】:2011-03-02 19:04:35
【问题描述】:
在我的 ViewModel 对象中,我有一个这样的索引器:
public bool this[enum effectType]
{
get { return CheckList.First ( e => e.EffectType == effectType ).IsChecked; }
}
但不确定如何在 Xaml 中绑定它。我试过这些:
<GridViewColumn
<GridViewColumn.CellTemplate>
<DataTemplate>
<CheckBox
IsChecked="{Binding Item[Blur], Mode=TwoWay}"/>
</DataTemplate>
</GridViewColumn.CellTemplate>
</GridViewColumn>
IsChecked="{Binding this[Blur], Mode=TwoWay}"/>
IsChecked="{Binding AllEffects[Blur], Mode=TwoWay}"/>
【问题讨论】:
标签: c# .net wpf xaml data-binding