大佬教程收集整理的这篇文章主要介绍了使用MergedDictionaries(UWP)拆分generic.xaml文件的正确语法是什么,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
<resourceDictionary.MergedDictionaries> <resourceDictionary source="<url_Syntax_file_1>" /> <resourceDictionary source="<url_Syntax_file_2>" /> </resourceDictionary.MergedDictionaries>
> MyCustomcatontrolsProject(项目/文件夹)
> Generic.xaml(文件)
> ControlTemplates(文件夹)
> MyControl1.xaml(文件)
> MyControl2.xaml(文件)
在过去,我使用以下语法在Silverlight和Silverlight for Win Phone中执行此操作:
<resourceDictionary.MergedDictionaries> <resourceDictionary source="/MyCustomcatontrolsProject;Component/Themes/ControlTemplates/MyControl1.xaml"/> <resourceDictionary source="/MyCustomcatontrolsProject;Component/Themes/ControlTemplates/MyControl2.xaml"/> </resourceDictionary.MergedDictionaries>
对于使用此语法的Windows Phone 8.1:
<resourceDictionary.MergedDictionaries> <resourceDictionary source="ms-appx:///Themes/ControlTemplates/MyControl1.xaml" /> <resourceDictionary source="ms-appx:///Themes/ControlTemplates/MyControl2.xaml" /> </resourceDictionary.MergedDictionaries>
这些语法都不适用于Win 10(UWp).尝试使用这些会导致运行时异常:
An exception of type 'WindowS.UI.Xaml.Markup.XamlParseException' occurred in MyApplication.exe but was not handled in user code WinRT information: Failed to assign to property 'WindowS.UI.Xaml.resourceDictionary.source' because the type 'Windows.Foundation.@R_801_10495@ng' cAnnot be assigned to the type 'Windows.Foundation.Uri'.
我也试过这种语法导致了同样的异常:
<resourceDictionary.MergedDictionaries> <resourceDictionary source="ControlTemplates/MyControl1.xaml" /> <resourceDictionary source="ControlTemplates/MyControl2.xaml" /> </resourceDictionary.MergedDictionaries>
有趣的是,似乎app.xaml使用上面的语法没有问题.
有没有人知道generic.xaml中resourceDictionary节点中source属性中url字符串的正确语法?或者这是UWP没有赶上的东西吗?
<resourceDictionary.MergedDictionaries> <resourceDictionary source="ms-appx:///MyCustomcatontrolsProject/Themes/ControlTemplates/MyControl1.xaml" /> <resourceDictionary source="ms-appx:///MyCustomcatontrolsProject/Themes/ControlTemplates/MyControl2.xaml" /> </resourceDictionary.MergedDictionaries>
以上是大佬教程为你收集整理的使用MergedDictionaries(UWP)拆分generic.xaml文件的正确语法是什么全部内容,希望文章能够帮你解决使用MergedDictionaries(UWP)拆分generic.xaml文件的正确语法是什么所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。