I have declared a DataTemplate in Window.Resources; I don't intend to use it inside an ItemsControl, but rather just use it as a user control. How do I put it on a form?
+1
A:
If you're using MVVM, and want to display the DataTemplate in response to a property on your ViewModel, you can use:
<ContentPresenter Content="{Binding Data}"/>
Where Data is a property of the type you registered the DataTemplate with.
Groky
2010-04-08 16:02:31
+3
A:
You can put a ContentControl into your user control, and set its ContentTemplate
to your DataTemplate
.
<ContentControl ContentTemplate="{StaticResource keyOfDataTemplate}"/>
Andy
2010-04-08 16:02:53
Andy I hope my edits are ok with you
Rob Fonseca-Ensor
2010-04-08 16:09:58