When coding for Xamarin.Forms, how can I detect that the culture requires right-to-left text? I was expecting to be able to test CultureInfo.TextInfo.IsRightToLeft but that property does not seem to be available.
Answered my own question - it seems that IsRightToLeft is, like some of the other globalization stuff, (unexpectedly) private.
As a result, I ended up using reflection, as follows:
bool rightToLeft = false; PropertyInfo propertyInfo = thisCulture.TextInfo.GetType().GetRuntimeProperty("IsRightToLeft"); object value = propertyInfo?.GetValue(thisCulture.TextInfo); if (value is bool) rightToLeft = (bool) value;
Answers
Answered my own question - it seems that IsRightToLeft is, like some of the other globalization stuff, (unexpectedly) private.
As a result, I ended up using reflection, as follows: