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。