Reputation: 983
i am developing an windows phone app.
I am having a listbox , in which depending upon on one particular condition i want to change only one listboxitem background colour .
Please Note :- i want to change background colour of only some listboxitems depending upon some particular condition.
Please let me know how i can achieve this ??
What are the various alternatives ??
Thanks in advance.
Upvotes: 1
Views: 230
Reputation: 1374
While you are binding the item sources to list box, add a property called background color and set this background color based on condition.
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 });
In the XAML you set the Background={Binding Background} for the list item.
If you have any issues let me know to it.
Upvotes: 2