ItemsControl with multiple DataTemplates for a viewmodel

前端 未结 4 1502
陌清茗
陌清茗 2020-11-29 04:59

is it possible to bind an itemscontrol with canvas as template to multiple DataTemplates?

I have 2 collections and depending on the type I would like to display a di

4条回答
  •  旧时难觅i
    2020-11-29 05:27

    Another option with less code behind would be to define two ListBoxes, each with their own templates and bound to their own collections. Define them each in the same physical space and just control which one is visible based on your state. You could even do this with the Visual State Manager and custom states.

提交回复
热议问题