1

I want to create a ListView with the names and the codes of the products in my ModelView but when I do:

<ListView ItemsSource="{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?

Jaime Oro
  • 9,899
  • 8
  • 31
  • 39

1 Answers1

2

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>
Mårten Wikström
  • 11,074
  • 5
  • 47
  • 87