1 0 Tag Archives: bidi
post icon

Silverlight Tip of the Day #32 – BiDi – Bi-Directional Text

BiDi or Bi-directional text is text that flows right-to-left (RTL) and left-to-right (LTR). For example, while English flows left to right other languages such as Arabic, Hebrew and Persian scripts flow right to left. Chinese characters can also be written in either RTL or LTR directions.

Silverlight supports BiDi through a property called FlowDirection. This property can be set to either RightToLeft or the default LeftToRight.

The following code below demonstrates this property in action:

<TextBlock FlowDirection="RightToLeft" Text="نصائح Silverlight من اليوم"/>
<TextBlock FlowDirection="RightToLeft" Text="Silverlight 每日提示"/>
<TextBlock FlowDirection="LeftToRight" Text="Silverlight Tips of the Day"/>

 

The first two TextBlocks flow RTL and the last one flows LTR.

Demo:

Install Microsoft Silverlight

Note that this property can also be applied to other controls such as RichTextBox, ListBox, TextBox, etc.

Source: Tip32_BIDI.zip

Thanks,

–Mike

Leave a Comment