Windows Phone 8 ListBox与CheckBox MVVM问题 [英] Windows Phone 8 ListBox With CheckBox MVVM problem
本文介绍了Windows Phone 8 ListBox与CheckBox MVVM问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我的Checkbox中有一个复选框内的复选框绑定到我的ViewModel类中的属性:
I have Listbox that has a checkbox inside the Checkbox is bound to a Property that is in my ViewModel Class:
private bool isChecked;
public bool IsChecked
{
get
{
return isChecked;
}
set
{
if (isChecked != value)
{
isChecked = value;
RaisePropertyChanged("IsChecked");
}
}
}
这就是我将它绑定到ListBox的方式:
and this is how I have bound it to my ListBox:
<CheckBox Grid.Column="0" IsChecked="{Binding Path=DataContext.IsChecked,UpdateSourceTrigger=Default,ElementName=List,Mode=TwoWay}" />
我的问题是当我检查一个复选框时所有其他复选框获得检查,可能是什么问题? ?
My Problem is that when I Check one CheckBox all the Other CheckBoxes Get Checked, What could be the Problem??
推荐答案
您好@StarNetNavid,请删除"DataContext"。来自你的路径。
Hi @StarNetNavid, REmove the "DataContext" from your Path.
<CheckBox Grid.Column="0" IsChecked="{Binding Path=IsChecked,UpdateSourceTrigger=Default,ElementName=List,Mode=TwoWay}" />
问候
这篇关于Windows Phone 8 ListBox与CheckBox MVVM问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文