Binding Dictionary to a WPF ListBox

前端 未结 2 1011
时光取名叫无心
时光取名叫无心 2020-12-25 13:17

Given a dictionary of , how would you bind the dictionary.Values to a WPF ListBox, so that the items use the .Name

2条回答
  •  悲&欢浪女
    2020-12-25 13:56

    ListBox.DisplayMemberPath = "Name";

    That will tell the listbox to use the 'Name' property of the DataContext

提交回复
热议问题