I want to create a ListView
with the names and the codes of the products in my ModelView but when I do:
<ListView Items开发者_JAVA技巧Source="{Binding Path=Products}"
SelectedValue="{Binding Path=Product}" />
Only the Product Guids are showed.
How could I create a column with the Product.Name
property and another onew with the Product.Code
property?
Use a GridView. Perhaps like this:
<ListView ItemsSource="{Binding Products}">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}"/>
<GridViewColumn Header="Code" DisplayMemberBinding="{Binding Code}"/>
</GridView>
</ListView.View>
</ListView>
精彩评论