Thursday, March 31, 2011

WPF / Silverlight showing content in ControlTemplates

While styling the control template for TabItem for wpf I noticed that the content required to be displayed in the TabItem is actually the header property.

For this in the template ContentPresent with ContentSource="Header" was used.

But ContentSource is not present for Silverlight 4. So I decided to see how silverlight did it. Turns out it is simply ContentControl bound to the Header using TemplateBinding :



Seems obvious in retrospect.

Enjoy!

No comments:

Post a Comment