在组合框中选择项目时切换datatemplate [英] Switch datatemplate when select item in combobox

查看:54
本文介绍了在组合框中选择项目时切换datatemplate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在视图中有几个DataTemplates和一个组合框。现在我想从下拉菜单中选择一个项来切换相应的DataTemplate。如何触发它?



一个小例子将不胜感激。



我有什么试过:



查找类似的一个另一个,但它不能使用。

I have several DataTemplates and a combobox in the view. Now I want to select an item from the dropdown menu to switch the corresponding DataTemplate. How to trigger it?

A small example would be appreciated.

What I have tried:

Find a similar one and another one, but it can't be used.

推荐答案

找到它。完全相同!



ContentControl.ContentTemplateSelector属性(System.Windows.Controls) [ ^ ]
Find it. Exactly same!

ContentControl.ContentTemplateSelector Property (System.Windows.Controls)[^]


这篇关于在组合框中选择项目时切换datatemplate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆