is it possible to insert some UserControl into ContentControl?
but I need to dynamically decide which UserControl I need to insert (like with DataTemplateSelector).
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Yes, you can place any object in
ContentControl.Content, however depending on what determines what UserControl you want, there are multiple ways of accomplishing this.My personal favorite is to go with a
DataTriggerthat determines theContentControl.ContentTemplatebased on some conditionHere’s an example that bases the
ContentControl.Contenton a ComboBox’s selected value: