Jump to content

  • Log In with Google      Sign In   
  • Create Account


#Actualjwezorek

Posted 21 September 2012 - 04:32 PM

It works because an ICollectionView has the CurrentItem property and all collections have a default view instance that can be accessed by calling GetDefaultView(). So, when you bind a regular collection, such as an ObservableCollection, then WPF automatically binds to its default view (see Using a default View).


Still not following ... there's two controls, a listbox and a content control which are bound to an observable collection as their Content and ItemSource properties respectively.

Are you saying that the ObservableCollection has an instance of some object that instantiates the ICollectionView interface and uses this object, by default, to track the current item in the ObservableCollection? -- so in essence the ObservableCollection has a current item: it's just stored in some other object? Because ObservableCollection itself isn't an ICollectionView ... it isn't any kind of view; it's a viewmodel right?

#1jwezorek

Posted 21 September 2012 - 04:31 PM

It works because an ICollectionView has the CurrentItem property and all collections have a default view instance that can be accessed by calling GetDefaultView(). So, when you bind a regular collection, such as an ObservableCollection, then WPF automatically binds to its default view (see Using a default View).


Still not following ... there's two controls, a listbox and a content control which are bound to an observable collection as their Content and ItemSource properties respectively.

Are you saying that the ObservableCollection has an instance of some object that instantiates the ICollectionView interface and uses this object, by default, to track the current item in the ObservableCollection? -- so in essence the ObservableCollection has a current item it's just stored in some other object? Because ObservableCollection itself isn't an ICollectionView ... it isn't any kind of view; it's a viewmodel right?

PARTNERS