在XAML中编写嵌套类型时发生设计时错误 [英] Design time error while writing Nested type in xaml

查看:153
本文介绍了在XAML中编写嵌套类型时发生设计时错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个用户控件,该控件接受枚举类型并将该枚举的值分配给该用户控件中的ComboBox控件.很简单. 我在DataTemplates中使用此用户控件.当出现嵌套类型时,问题就来了. 我使用这种表示法进行分配

I have created a usercontrol which accept type of enum and assign the values of that enum to a ComboBox control in that usercontrol. Very Simple. I am using this user control in DataTemplates. Problem comes when there comes nested type. I assign that using this notation

EnumType ="{x:Type myNamespace:ParentType + NestedType}"

EnumType="{x:Type myNamespace:ParentType + NestedType}"

它在运行时运行良好.但是在设计时,它会抛出错误信息

It works fine at runtime. but at design time it throws error saying

Could not create an instance of type 'TypeExtension'

为什么? 因此,我无法在设计时看到我的窗口.有帮助吗?

Why? Due to this I am not able to see my window at design time. Any help?

推荐答案

According to Rob Relyea form Microsoft this is a defect within the VS2008/2010 designer.

我们让某人研究了{x:Type Foo + Bar}模式的使用并进行了测试 它在VS2010和Blend4中.看来它在运行时可以正常工作, 在Blend 4中为CompileTime,但在VS2010的WPF设计器中失败.

We had somebody look at the use of {x:Type Foo+Bar} pattern and test it in VS2010 and Blend4. It appears that it works fine at Runtime, CompileTime, in Blend 4, but fails in VS2010's WPF Designer.

我们已经提交了一个错误,并将其发送给WPF设计器团队.

We've filed a bug, and routed it to the WPF Designer team.

这篇关于在XAML中编写嵌套类型时发生设计时错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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