WPF: switching UserControls depending on corresponding ViewModels (MVVM)

前端 未结 2 1719
终归单人心
终归单人心 2021-02-01 06:22

I\'ll try to simplify the task I\'m working on by imagining this example:

Let\'s suppose that we have the following hierarchy of model classes:

Animal
           


        
2条回答
  •  隐瞒了意图╮
    2021-02-01 06:51

    You can use DataTemplateSelector for that. The method of choosing the right template is up to you. You can use enums or test for class type if you wish.

提交回复
热议问题