<Window.Resources>
<DataTemplate x:Key="PersonDataTemplate">
<StackPanel Orientation="Horizontal">
<TextBlock Text="{Binding Path=Name}" />
<TextBlock Text="{Binding Path=Age}" />
</StackPanel>
</DataTemplate>
</Window.Resources>
public Window1()
{
InitializeComponent();
DataTemplate dataTemplate = FindResource("PersonDataTemplate") as DataTemplate;
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3468 次 |
最近记录: |