积极答复者
关于Resx文件数据绑定的问题

问题
答案
-
没太明白,既然是特定的字符串,为什么还要和ResourceDictionary绑定呢。
绑定就是为了灵活,而定义的这些静态资源就是不变的。
本身的目的都不同,建议别把他俩弄到一起。
专注于Windows Phone- 已标记为答案 世外涛缘MVP, Moderator 2011年10月31日 6:55
-
你好
應該是不可以的...
因為ApplicationBar不是Silverkight Control..所以不支援數據鎖定..
You can add an Application Bar to a page in your application either in the page’s XAML or using C# in the page’s code-behind. However, because the Application Bar is not a Silverlight control, it does not support dynamic data binding for the text label of the ApplicationBarIconButton or for the text of the ApplicationBarMenuItem. For this reason, if you want to localize these strings, you must create or update the Application Bar at runtime. The following code example shows a helper function that builds an Application Bar using localized resources to provide the string values. This example assumes that you have created a localized resource DLL with string table entries called “ButtonText” and “MenuItemText”. For information on creating an application bar, see Application Bar Overview for Windows Phone.
詳情可以參考以下URL
http://msdn.microsoft.com/zh-cn/library/ff637520(v=vs.92).aspx
Please correct me if my concept is wrong
Chi- 已标记为答案 世外涛缘MVP, Moderator 2011年10月31日 6:55
全部回复
-
没太明白,既然是特定的字符串,为什么还要和ResourceDictionary绑定呢。
绑定就是为了灵活,而定义的这些静态资源就是不变的。
本身的目的都不同,建议别把他俩弄到一起。
专注于Windows Phone- 已标记为答案 世外涛缘MVP, Moderator 2011年10月31日 6:55
-
你好
應該是不可以的...
因為ApplicationBar不是Silverkight Control..所以不支援數據鎖定..
You can add an Application Bar to a page in your application either in the page’s XAML or using C# in the page’s code-behind. However, because the Application Bar is not a Silverlight control, it does not support dynamic data binding for the text label of the ApplicationBarIconButton or for the text of the ApplicationBarMenuItem. For this reason, if you want to localize these strings, you must create or update the Application Bar at runtime. The following code example shows a helper function that builds an Application Bar using localized resources to provide the string values. This example assumes that you have created a localized resource DLL with string table entries called “ButtonText” and “MenuItemText”. For information on creating an application bar, see Application Bar Overview for Windows Phone.
詳情可以參考以下URL
http://msdn.microsoft.com/zh-cn/library/ff637520(v=vs.92).aspx
Please correct me if my concept is wrong
Chi- 已标记为答案 世外涛缘MVP, Moderator 2011年10月31日 6:55
-
非常感谢您的回复!
我用了一个第三方开发的BindableApplicationBar的类库,可以实现绑定了,但是这个BindableApplicationBar在当一个页面拥有不同的Appbar时不适用(也就是Pivot或者Panorama控件)
所以,我现在想只能在系统的Appbar上绑定,我尝试了一下,类似{Binding}这样的方式都是不支持的,但是{StaticResource}可以支持,换句话说,我可以把我的字符串资源定义在ResourceDictionary中如下:<sys:String x:Key="MenuItem2">Paste</sys:String>(需要添加控件引用),从而在Text中绑定。
但是,现在,我的各种语言的字符串资源都是放在resx资源文件中来定义的,所以,我在想是不是可以把resx文件中的包含Appbar text内容的字符串资源进而绑定到resourceDictionary中来使用。