0
是否有可能将下面的代码中的uri绑定到静态资源?我有一个资源文件中定义的URL,并希望绑定到这里,而不是在这里对这些值进行硬编码。将UriMapper.Uri绑定到silverlight中的静态资源4
<navcore:UriMapper x:Key="uriMapper" >
<navcore:UriMapping Uri="Home" MappedUri="/Home.xaml" />
</navcore:UriMapper>
我想声明静态资源和绑定到它就像在下面的例子,但它未能
<Application.Resources>
<local:URLContainer x:Key="URLContainer" />
<navcore:UriMapper x:Key="uriMapper" >
<navcore:UriMapping Uri="Home" MappedUri="{Binding Source={StaticResource URLContainer}, Path=HomeUrl}" />
</navcore:UriMapper>
</Application.Resources>
错误,我得到的,当我使CLR例外是:
对象类型 'System.Windows.Data.Binding'不能将 转换为'System.Uri'类型。
我公开了资源文件构造函数,并将访问级别设置为public。