Monday, June 11, 2007

Changing Silverlight Text Direction Right to Left

In some languages text has to be displayed in right to left direction. 
For this case we don't have any property supported by XAML, Java script.
To achieve it we can use following traditional way.
Silverlight 1.1
        char[] str = mystr.Text.ToCharArray();
Array.Reverse(str);
mystr.Text = new string(str);

Silverlight 1.0


mystr.Text = mystr.Text.split('').reverse.join('');
Hope It could be useful for silverlight lovers. Please post your comments bellow.

2 comments:

Yosi said...

you could have given the credit to tamir who post it on: http://blogs.microsoft.co.il/blogs/tamir/archive/2007/06/10/Right_2D00_To_2D00_Left-support-for-Silverlight.aspx

Kevin said...

Rhe problem is that rtl languages display numbers the same way as ltr languages (28 is still "28", not "82") and often times english must be displayed inline.