我需要能够在UserControl中设置System.Type类型的属性。我正在做这件事:
XAML:
<MyUserControl x:Name="TheControl"/>代码隐藏:
TheControl.TheType = typeof(My.NameSpace.MyType);我希望能够做到这一点(仅限XAML):
<MyUserControl x:Name="TheControl" TheType="??"/>有没有办法在XAML中使用typeof?
发布于 2010-08-16 20:53:01
使用x:Type Markup Extension:
<MyUserControl
xmlns:myns="clr-namespace:My.NameSpace"
x:Name="TheControl"
TheType="{x:Type myns:MyType}"/>https://stackoverflow.com/questions/3493241
复制相似问题