Display multiple types from a single list in a WPF ListBox?

后端 未结 2 1715
粉色の甜心
粉色の甜心 2020-12-16 01:11

I have an ObservableCollection that contains two different types.

I want to bind this list to a ListBox and display different DataTemplate

2条回答
  •  借酒劲吻你
    2020-12-16 01:42

    You have to use a DataTemplateSelector. See here for an example.

    Addiontal information on MSDN

提交回复
热议问题