Windows phone 7 如何在windows phone应用程序中更改列表框中某个特定列表框项目的背景色?

Windows phone 7 如何在windows phone应用程序中更改列表框中某个特定列表框项目的背景色?,windows-phone-7,windows-phone-8,windows-phone-7.1,windows-phone-7.1.1,Windows Phone 7,Windows Phone 8,Windows Phone 7.1,Windows Phone 7.1.1,我正在开发一个windows phone应用程序 我有一个listbox,根据一个特定条件,我只想更改一个listboxitem背景颜色 请注意:-我只想根据某些特定条件更改某些listboxitems的背景颜色 string background; if(condition) background="Red"; //Color you wish to set List<ItemSet> source=new List<ItemSet>(); source.Add( n

我正在开发一个windows phone应用程序

我有一个listbox,根据一个特定条件,我只想更改一个listboxitem背景颜色

请注意:-我只想根据某些特定条件更改某些listboxitems的背景颜色

string background;
if(condition)
background="Red"; //Color you wish to set
List<ItemSet> source=new List<ItemSet>();

source.Add( new ItemSet(){ Background=background, OtherProperty=properties });
请让我知道我如何才能做到这一点

有哪些不同的选择


提前感谢。

当您将项目源绑定到列表框时,添加一个名为background color的属性,并根据条件设置此背景色

string background;
if(condition)
background="Red"; //Color you wish to set
List<ItemSet> source=new List<ItemSet>();

source.Add( new ItemSet(){ Background=background, OtherProperty=properties });
字符串背景;
如果(条件)
背景=“红色”//要设置的颜色
列表源=新列表();
Add(newitemset(){Background=Background,OtherProperty=properties});
在XAML中,为列表项设置背景={Binding Background}

如果你有任何问题,请告诉我