假設我有3個項目:LibClassProj
,Proj1
和Proj2
在windows phone develompment by c#中。 Proj1
和Proj2
分享LibClassProj
中的代碼。它工作正常。現在的問題是,我無法從Proj1
或Proj2
的xaml獲取LibClassProj
的AppResources.resx中的字符串。WP8多個項目由Windows Phone類庫共享代碼,但無法共享AppResources.resx
例如,這是來自LibClassProj
的xaml的一部分。
SelectableButtonText="{
Binding Path=LocalizedResources.strTestButtonTitleClose,
Source={StaticResource LocalizedStrings}}"
當我把strTestButtonTitleClose
在LibClassProj的AppResources.resx文件,我不能讓這個字符串Proj1
或Proj2
(這意味着在設置Proj1
或Proj2
啓動項目)。如果我把它放在Proj1
的AppResources.resx中,當我選擇Proj1
作爲啓動項目時,我可以得到它。與Proj2
相同。
任何人都知道如何才能將字符串只在LibClassProj
的AppResources.resx,我可以從其他項目訪問它?謝謝。
謝謝你的迴應。我努力了這一點,它找不到LocalizedStrings。 YourApp Here:'xmlns:lib =「clr-namespace:YourApp.LibClassProj; assembly = YourApp.LibClassProj」'你的意思是Proj1.LibClassProj? – Vigor
「Proj1.LibClassProj」是否存在?我的理解是你有「LibClassProj」,「Proj1」和「Proj2」。我的建議是在每個Proj1和Proj2中定義xmlns:lib,並指向LibClassProj。這允許在Proj1和Proj2中使用來自LibClassProj的字符串。 – siger
嗨@mleroy,我明白你的意思。我只是對我的情況** YourApp **應該是什麼感到困惑,我只有VS中的3個項目:'LibClassProj','Proj1'和'Proj2'。 'LibClassProj'已被添加到'Proj1'和'Proj2'的參考。 – Vigor