Different View depending on ContentControl (Caliburn.Micro)

前端 未结 1 1199
轮回少年
轮回少年 2021-02-01 05:13

I\'m binding ViewModels to ContentControls and letting Caliburn taking care of creating and binding the view. However, I would like to customize Caliburns ViewModel->View conven

1条回答
  •  囚心锁ツ
    2021-02-01 05:28

    Yes, it is possible.

    Use cal:View.Context attached property and then name your view for the specified context like YourNamespace.Something.ContextView (remove "ViewModel" from your view model name, add a dot, and the value of Context property).

    By that, you can even bind several views to one view model.

    Example:

    
    

    You can see working example here (from CoProject sample application, part 9).

    0 讨论(0)
提交回复
热议问题