I have been localizing a Xamarin Forms app at work. It has been going exceedingly well and localizing with the RESX files is smooth and simple...
until I got to the one and only ListView in the app
The app has menu options to change the language on-the-fly. We are not relying on the culture info setting of the device. Localization is within the app only.
To assign localized button text I would use the button's x:Name and assign the resource
ie: HelloButton.Text = AppResource.HelloButtonText
I wanted to iterate through the ListView and change all the button, label and placeholder text to the current language on-the-fly. This is what I wanted to do:
foreach(var item in MyListView.Items)
Button helloButton = item.FindByName("HelloButton");
helloButton.Text = AppResource.HelloButtonText;
I read ListView doesn't implement IEnumerable or ICollection so the Items property does not exist.
So how to loop through a ListView to change all the buttons label text?
(Currently looking at a DataTemplateSelector class to build both a French and English data template and swap it out programmatically, but I'd rather not if there is another way)