xaml – Windows应用程序项目中不支持Type

如何从XAML样式或模板引用类型?
WPF语法在我的
Windows应用商店项目中不起作用.

IDE咆哮着“在Windows应用程序项目中不支持类型”.

解决方法

使用以下语法:

<Style TargetType="xmlNamespacePrefix:MyControlClassName" >
    ...

也就是说,您不需要在Windows应用商店和手机应用中使用{x:Type}语法.

MSDN说:

If you have used XAML for Windows Presentation Foundation (WPF),then
you might have used an x:Type markup extension to fill in any XAML
values that take a System.Type. The Windows Runtime XAML parser does
not support x:Type. Instead,you should refer to the type by name
without using any markup extension,and any necessary XAML-to-backing
type conversion is already handled by the built-in conversion behavior
in the XAML parser.

http://msdn.microsoft.com/en-us/library/windows/apps/windows.ui.xaml.style.targettype

dawei

【声明】:舟山站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

相关文章