In the last line you should be setting the ItemSource of ListBox to myChannels.
Up vote 0 down vote favorite share g+ share fb share tw.
I have an ObservableCollection, and this is MyObject definition: public class MyObject : INotifyPropertyChanged { private bool favourite; public event PropertyChangedEventHandler PropertyChanged; public bool Favourite { get { return favourite; } set { favourite = value; var eh = PropertyChanged; if (eh! = null) { eh(this, new PropertyChangedEventArgs("Favourite")); } } } public bool Name { get; set; } } I want to bind this collection to a WP7 listbox, but only the elements that have the property Favourite = true. How should I bind the listbox to the collection?
Have in consideration that ObservableCollection, that is a global variable, receives changes (Favourite value) from other parts of the application. I tried this without success (when the favourite property of one element changes, the listbox is not refreshed): ObservableCollection myChannels = (((App)Application. Current).
FavouriteChannels . Where(f=>f. Favorito == true) .
OrderBy(o => o. SortIndex) .ToList()). ToObservableCollection(); this.listFavoritos.
ItemsSource = myChannels; Any ideas? Windows-phone-7 listbox inotifypropertychanged link|improve this question edited Jun 23 '11 at 18:43 asked Jun 23 '11 at 16:07xus208211 78% accept rate.
In the last line you should be setting the ItemSource of ListBox to myChannels. This.listFavoritos. ItemSource = myChannels.
The simplest solution is to create a seaparate collection which just contains the items you want. Alternatively, you could use a CollectionViewSource.
The simplest solution is to create a seaparate collection which just contains the items you want.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.