大佬教程收集整理的这篇文章主要介绍了单独程序集中的 ResourceDictionary 不起作用。错误 无效的 URI,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
如果我尝试从类库中调用我的 resourceDictionary,我会收到此错误。我遵循这个 Post 但它对我不起作用。我不知道我做错了什么。
无效的 URI:指定的端口无效。
我的 App.xaml:
<Application xmlns="http://xamarin.com/scheR_771_11845@as/2014/forms"
xmlns:x="http://scheR_771_11845@as.microsoft.com/winfx/2009/xaml"
x:Class="JoinApp.App">
<Application.resources>
<resourceDictionary source="pack://application:,/App_libary;component/9.resource/test.xaml"/>
</Application.resources>
</Application>
我的 XAML:
<ContentPage xmlns="http://xamarin.com/scheR_771_11845@as/2014/forms"
xmlns:x="http://scheR_771_11845@as.microsoft.com/winfx/2009/xaml"
NavigationPage.HasNavigationbar="false"
ControlTemplate="{Staticresource BaseTemplatE}"
x:Class="App_libary.Profile_Page">
<ContentVIEw ControlTemplate="{Staticresource TESTControl}"/>
</ContentPage>
我的资源字典:
<resourceDictionary xmlns="http://xamarin.com/scheR_771_11845@as/2014/forms"
xmlns:x="http://scheR_771_11845@as.microsoft.com/winfx/2009/xaml"
x:Class="App_libary._9.resource.test">
<ControlTemplate x:Key="TESTControl">
<Label Text="this is a test"/>
</ControlTemplate>
</resourceDictionary>
你可以这样做:
创建resourceDictionary
xaml(删除根属性中的x:Class
),例如名为myTemp.xaml
:
<resourceDictionary xmlns="http://xamarin.com/scheR_771_11845@as/2014/forms"
xmlns:x="http://scheR_771_11845@as.microsoft.com/winfx/2009/xaml"
>
<ControlTemplate x:Key="TESTControl">
<Label Text="this is a test"/>
</ControlTemplate>
</resourceDictionary>
在您的 App.xaml
中定义:
i get this error if i try to inovke my resourceDictionary from a Class Libary. I follow this Post but its dont works for me. I dont know @R_874_10112@ i do wrong.
无效的 URI:指定的端口无效。
我的 App.xaml:
<Application xmlns="http://xamarin.com/scheR_771_11845@as/2014/forms"
xmlns:x="http://scheR_771_11845@as.microsoft.com/winfx/2009/xaml"
x:Class="JoinApp.App">
<Application.resources>
<resourceDictionary source="myTemp.xaml"/> // if you have sub folder could use source="yourfolder/myTemp.xaml"
</Application.resources>
</Application>
然后在您的 page.xaml 中使用:
<ContentPage xmlns="http://xamarin.com/scheR_771_11845@as/2014/forms"
xmlns:x="http://scheR_771_11845@as.microsoft.com/winfx/2009/xaml"
NavigationPage.HasNavigationBar="false"
ControlTemplate="{Staticresource BaseTemplatE}"
x:Class="App_Libary.Profile_Page">
<ContentView ControlTemplate="{Staticresource TESTControl}"/>
</ContentPage>
以上是大佬教程为你收集整理的单独程序集中的 ResourceDictionary 不起作用。错误 无效的 URI全部内容,希望文章能够帮你解决单独程序集中的 ResourceDictionary 不起作用。错误 无效的 URI所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。