简体   繁体   English

ListBox / ListView等控件的默认ItemTemplate

[英]Default ItemTemplate of Controls like ListBox/ListView

Where can I find the default ItemTemplate of controls like ListBox / ListView ? 我在哪里可以找到像ListBox / ListView这样的ListBox的默认ItemTemplate There's nothing in MSDN about this. MSDN中没有关于此的内容。

<ListBox.ItemTemplate>
    <DataTemplate>
        <!--What's the default value of this?-->
    </DataTemplate>
</ListBox.ItemTemplate>

From WPF Tutorial : 来自WPF教程

Data Templates give you a very flexible and powerful solution to replace the visual appearance of a data item in a control like ListBox, ComboBox or ListView. 数据模板为您提供了一个非常灵活和强大的解决方案,可以替换ListBox,ComboBox或ListView等控件中数据项的可视外观。

If you don't specify a data template, WPF takes the default template that is just a TextBlock. 如果未指定数据模板,WPF将采用仅为TextBlock的默认模板。

Ie the default should be: 即默认值应为:

<ListBox.ItemTemplate>
    <DataTemplate>
        <TextBlock Text="{Binding}"/>
    </DataTemplate>
</ListBox.ItemTemplate>

Read more on DataTemplate 阅读有关DataTemplate更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM