WPF负载控制问题 [英] WPF Load Control question
问题描述
我正在WPF中做一些事情.
I'm doing some stuff in WPF.
我有一个 ComboBox
,其中包含许多 Types .选择具体类型后,我希望能够加载特定的UserControl (具有许多TextBox等),以尊重WPF窗口中已定义区域中的类型.
I have a ComboBox
with many Types. After selecting a concrete type, I want to be able to Load a particular UserControl (with many TextBoxes etc.) respecting the type in a defined region on my WPF Window.
该怎么做?有没有类似的东西 LoadControl()
并将其加载到ASP.NET中的 PlaceHolder
中?这样做的最佳方法是什么?
How to do that? Is there anything like
LoadControl()
and load it into a PlaceHolder
in ASP.NET? And what's the best way of doing this?
谢谢.
推荐答案
您应该为每种类型创建一个 DataTemplate
.请参阅 WPF列表中每个项目的不同项目模板了解更多信息.
You should create a DataTemplate
for each type. See Different item template for each item in a WPF List for more information.
这篇关于WPF负载控制问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!