Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support dynamic language key #22

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Support dynamic language key #22

wants to merge 1 commit into from

Conversation

Cricle
Copy link
Owner

@Cricle Cricle commented Jul 15, 2024

Import ILangKey interface and LangKey class for Ao.Lang, support dynamic language key.

Usage:

private ILangKey langKey = new LangKey();
Btn.BindLang(ContentProperty, langKey/*A interface impl*/,new object[] {"123"});

When changed LangKey.Key, the property will be raise update value.

Fixed #21

TODO:

  • Addin tests

@flier268
Copy link
Contributor

這樣的使用方式太繁瑣了,必需要給xaml上的元件一個name,然後在.cs裡面寫兩行,每一個綁定都要,如果我要做一個選單,選單內容來自資料庫,數量不特定,選單文字也要多國語言,這樣的寫法就很難達成,也無法MVVM

可以參考這個的做法

@Cricle
Copy link
Owner Author

Cricle commented Jul 30, 2024

這樣的使用方式太繁瑣了,必需要給xaml上的元件一個name,然後在.cs裡面寫兩行,每一個綁定都要,如果我要做一個選單,選單內容來自資料庫,數量不特定,選單文字也要多國語言,這樣的寫法就很難達成,也無法MVVM

可以參考這個的做法

麻烦是有点,但是我目标还是适用于任意UI框架的,所以我有空看看有没有类似你的但是更简单的方式去实现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

How to achieve it if Key also needs to be dynamic? Key如果也要動態該如何達成
2 participants