How to use DataTemplateSelector with ContentControl to display different controls based on the view-model?

后端 未结 2 1023
无人及你
无人及你 2021-01-17 04:52

I want to create a simple window that would display different controls (SpinEdit or TextEdit) based on the view-model that is selected.

I h

2条回答
  •  情深已故
    2021-01-17 05:07

    You have to add some value in the Content property of the ContentControl. That value will be passed to the SelectTemplate as the object item. You probably should bind to it some property in your ViewModel to be able to change that from there.

提交回复
热议问题