2011-05-16 66 views
3

有沒有辦法從xaml的資源文件中獲取超鏈接內容。我知道手背上有代碼。我嘗試過使用Name =「{x:Static Properties:Resources.stringname}」,但它會拋出錯誤是否有無法從WPF資源文件中獲取超鏈接內容

或者是否有任何解決方法?

我已經試過名稱,但它給出了一個錯誤:無法綁定到UID或Name屬性在XAML

+1

請刪除的問題或發佈一個合適的回答(不是問題裏面),它解釋瞭如何做到這一點和接受。 – 2011-05-16 18:29:21

+0

我改變了我的問題。 Thnx用於指出 – alice7 2011-05-16 20:15:30

+0

您的問題,標題和說明無效。你想從資源文件中獲取URL嗎? – user7116 2011-05-16 20:26:03

回答

4

如何:

<Hyperlink NavigateUri="{x:Static Properties:Resources.SomeUrl}"> 
    <Run Text="{x:Static Properties:Resources.SomeUrl_Description}"/> 
</Hyperlink> 
+0

是的,我猜它沒有點擊我使用超鏈接運行。我只是使用直接超鏈接,沒有辦法本地化它。 – alice7 2011-05-16 21:38:35

0

,因爲它是被內部使用,以創建引用不能綁定到XAML的Name,它需要獨一無二。一些相關的位from MSDN

Name is one of the very few dependency properties that cannot be animated (IsAnimationProhibited is true in metadata), because the name itself is vital for targeting an animation. Data binding a Name is technically possible, but is an extremely uncommon scenario because a data-bound Name cannot serve the main intended purpose of the property: to provide an identifier connection point for code-behind.

Names must be unique within a namescope. For more information, see WPF XAML Namescopes.

相關問題