开发者

How can I link a ListView to ModelView?

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜