开发者

Binding WPF controls with XML

What I need to do开发者_JAVA技巧 is like when user click on "English" from the combobox, the text of the button1 will be in English, likewise if the user click on "Japanese" from the combobox, the text of the button1 will be in Japanese.

So i have created a XML file, and imported it to the WPF.

And I have binded the Content of the button1 to be Content="{Binding langCollection[0].button1, Mode=Default}". So by default, when the user click on "English", the button1 text will be in English.

But now, I want it to be like when user click on "Japanese", the text of button1 will be in Japanese.

So what should i do?


try to use Linq to XML (XDocument, etc.) and take a look here and here


I recommend looking into the MVVM pattern. Your button's text should be bound to a property in your View Model which will change depending on the language selected.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜