开发者

bind UriMapper.Uri to a static resource in silverlight 4

Is it possible to bind the uri in the code below to a static resource? I have the urls defined in a resource file and wanted to bind to that rather than hardcoding the values here.

<navcore:UriMapper x:Key="uriMapper" >
            <navcore:UriMapping Uri="Home" MappedUri="/Home.xaml" />
</navcore:UriMapper>

I tried to declare a static resource and bind to it like in the example below but it failed

<Applicat开发者_运维技巧ion.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>

Error that i get when i enable CLR exceptions is:

Object of type 'System.Windows.Data.Binding' cannot be converted to type 'System.Uri'.

I have made the resource file constructor public and set the access level to public too.


MappedUri is not a Dependency Property, thus it can't be set through DataBinding.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜