Manually create a DataTemplate instance?

Can I use a data template for one item without a ListBox or other items?

I have a datatemplate that I want to create in xaml, not in a list, just inside the frame and set its datacontext.

Something like (pseudo):

<Window DataContext="{StaticResource Contact}">
    <!--
        Here I want to show a ContactTemplate for a single Contact
        as it would appear in an ItemsControl (ListBox etc.)
    -->
    <src:ContactTemplate Source="{Binding}"/>
</Window>
+5
source share
1 answer

You can install ContentTemplatefor ContentControlon DataTemplate. Is this what you are looking for?

+7
source

All Articles