谁能解释一下ItemTemplate.DataTemplate
和ListView
。在此代码片段中。我真的不理解Templates
的概念,如果有人也能给我一些启发的话,那将是非常有帮助的。我曾考虑过这个问题:
Metro app: ListView ItemTemplate DataTemplate for selected item
但还是很困惑。谢谢!:(
<ListView Margin="10" Name="lvDataBinding">
<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Text="Name: " />
<TextBlock Text="{Binding Name}" FontWeight="Bold" />
<TextBlock Text=", " />
<TextBlock Text="Age: " />
<TextBlock Text="{Binding Age}" FontWeight="Bold" />
<TextBlock Text=" (" />
<TextBlock Text="{Binding Mail}" TextDecorations="Underline" Foreground="Blue" Cursor="Hand" />
<TextBlock Text=")" />
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>
https://stackoverflow.com/questions/33339255
复制相似问题