Include Code  Search Tips
advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Download the Examples (C# and VB)!
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

WPF Wonders: Using DataTemplates

WPF data templates let you determine the pieces a repetitive control uses to display its items. Learn some unique and interesting ways to use data templates for displaying the items in ListBoxes, ComboBoxes, and ListViews. 


advertisement
y article WPF Wonders: Building Control Templates explains how to use templates to tell a control what components it should use to do its work. For example, you can use a template to make a Button use a polygon for its surface instead of the usual rectangle. The template can also determine how the Button reacts to state-changing events such as being under the mouse, being defaulted, being pressed, and so forth. This kind of template can change a control's fundamental structure and behavior.

This article describes another kind of template: a DataTemplate. A DataTemplate tells controls that display a series of items (such as ListBox, ComboBox, and TreeView) how to display their data items. Just as a control template tells a control what pieces to use to display itself, a DataTemplate tells a control what pieces to use to display each of its data items.


It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement