Silverlight 5 has added many new useful features. If you have not read about Silverlight 5's new features then read Silverlight 5: What’s New.
Implicit Templates is one of the new features included in Silverlight 5. Implicit Templates can be said to be data templates associated with a particular data type. These templates will be applied to all template-driven controls which are trying to display the specified data type.
For example, If you have two classes Manager and Employee both derived from the Person class. Now you would like to display the list of people in your company with different styling for each type of person. this is where Implicit Templates make your life easy.
Just specify two Data Templates for each of the two classes i.e. Manager and Employee.
<ListBox x:Name="PeopleList">
<ListBox.Resources><DataTemplate DataType="local:Manager"><StackPanel Orientation="Horizontal"><TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text="(Manager)" FontStyle="Italic" Margin="5,0,0,0"/></StackPanel></DataTemplate><DataTemplate DataType="local:Employee"><StackPanel Orientation="Horizontal"><TextBlock Text="{Binding Name}" />
<TextBlock Text="{Binding ManagerName, StringFormat='Managed by: {0}'}" FontStyle="Italic" Margin="5,0,0,0" Foreground="Gray" /></StackPanel></DataTemplate></ListBox.Resources></ListBox>
This will display some thing like this:
Implicit Templates does allow you to easily specific unique characteristics of an object in your data template.
Another example many people use for Implicit Templates is Twitter. See this example from Pete Brown. In his post, Pete Brown describes Implicit Templates in more detail.

Video: Pete Brown demonstrates Implicit DataTemplates.
Related Links






