WPF #53

obs.png

An ObservableCollection is a dynamic collection of objects of a given type. Objects can be added, removed or be updated with an automatic notification of actions. When an object is added to or removed from an observable collection, the UI is automatically updated. This happens because, when binding to an observable collection, WPF automatically adds a CollectionChanged event handler to the ObservableCollecion’s events. The ObservableCollection class exists in the System.Collections.ObjectModel namespace
Content-Presenter is a placeholder for any XAML content and it can be used to insert content at runtime. Or we can say that ContentPresenter is a class that will automatically take the content of the ContentControl and display it, when placed into a ContentControl’s ControlTemplate. it can be used with the DataTemplate. Data template describes how bound data is displayed. A data template can contain elements that are each bound to a data property along with additional markup that describes layout, color and other appearance. DataTemplate is, basically, used to specify the appearance of data displayed by a control not the appearance of the control itself.
A Value Converter functions as a bridge between a target and a source and it is necessary when a target is bound with one source, for instance you have a text box and a button control. You want to enable or disable the button control when the text of the text box is filled or null.

More topics covered:

  • Snoop, the WPF Spy Utility
  • ObservableCollection  requires ObservableCollection
  • Content-Presenter as a Window.Resource
  • ValueConverter convert back
  • ValueConverter for a Property data

Links:

 

Leave a comment