Since, in Silverlight (at least not in current version) there is no support for bidirectional text, I was asked to find a way to get over it. My first try was to try to apply TextDirection and Language properties of Run element (well known and used in WPF) in Silverlight. Unfortunately, there are no such properties (even internal) for this, so I start looking for another methods. As well as we have no such property in XAML element, we have no FormattedText object to pass Direction property there. So this "smart" method is also unacceptable. Translations and transformations are not very helpfully as well, so let's look into 90th. Time, when no one knows about BIDI support at all. The well-known method then was character array swapping. You can believe or not, but the same old stuff working well in Silverlight (both in 1.0 and 1.1 versions). How to do it? Really simple.
char[] text = myText.Text.ToCharArray();
Array.Reverse(text);
myText.Text = new string(text);
myText.Text = myText.Text.split('').reverse.join('');
We done, folks. Have a nice hebrew day.
No comments:
Post a Comment