How can I create a localization binding like {lex:LocTextUpper XXX}
in code? I have controls that, for reasons of performance, I need to create in code rather than in XAML but I wouldn't like to lose the comfort of automatic string replacement on UI culture change.
Asked
Active
Viewed 186 times
1

Gábor
- 9,466
- 3
- 65
- 79
-
2You can do it for example like this `new LocTextUpperExtension("Load").SetBinding(tb, TextBlock.TextProperty);` (where `tb` is some `TextBlock`) – Evk May 03 '18 at 10:57
-
Thanks, that works very well. It'd deserve an answer. :-) – Gábor May 03 '18 at 12:00
-
Well I have some doubts about that. For example, `LocTextUpperExtension` implements `IDisposable`, but who should dispose it in this case? Not sure – Evk May 03 '18 at 12:07