WPF - Display single entity with a data template

后端 未结 1 1303
北海茫月
北海茫月 2021-01-01 16:00

I Have a data template that i use in items control, i wanna know if its possible some how to use it(the template) on single item display without the items control?

相关标签:
1条回答
  • 2021-01-01 16:38

    You can probably do something like this

    **<DataTemplate x:Key="MyTemplate" DataType="{x:Type MyType}">**
        ...
    **</DataTemplate>**
    ...
    <ContentControl ContentTemplate="{StaticResource MyTemplate}" /> <!-- Single instance use -->
    <ItemsControl ItemTemplate="{StaticResource MyTemplate}" /> <!-- Multiple instance use -->
    
    0 讨论(0)
提交回复
热议问题