MvxLang Binding Syntax for SharedTextSource

I am using the MvvmCross Json Localization plugin. Everything works well for the View Model of specific resource files using the TextSource property in the View Model.

I added the SharedTextSource and ErrorTextSource on the view model, however I cannot find an example of how to use the Android MvxLang binding shortcut to them. I think something like:

 local:MvxLang="Text Buy, Path=SharedTextSource" 

However, they tell me: "You cannot specify ConverterParameter more than once." Should I use longhand binding for common and textual error sources?

In addition, MvvmCross is one of the best frameworks I have ever used.

+4
source share
1 answer

The Lang binding parser is located at https://github.com/slodge/MvvmCross/blob/v3/Cirrious/Cirrious.MvvmCross.Binding/Parse/Binding/Lang/MvxLanguageBindingParser.cs

He analyzes 4 things for each Lang binding:

  • The key - text search - is used as a parameter for the converter
  • Source - "TextSource" is used by default - essentially it is used as a binding path
  • Converter - a value converter is used (the default is "Language")
  • FallbackValue - value used for missing source - useful for development-time data

So for your binding you can use

  lang:MvxLang="Text Buy, Source=SharedTextSource" 
+5
source

Source: https://habr.com/ru/post/1493593/


All Articles