Feed on
Posts
Comments

Here’s a simple tip.  If you want to use the Silverlight Right to Left layout (RTL) support for languages like Arabic and Hebrew don’t search for RTL.   No, what you are looking for is the FlowDirection=’RightToLeft’  property.

I don’t think that Microsoft tried to hide this property but if you search for bidi or RTL you’ll come up empty handed.

Using FlowDirection

Here’s a simple demo showing a TabControl, Polyline and Calendar control.  These first examples are showing a Silverlight usercontrol using the default LeftToRight setting.

image

image

Now, let’s change the FlowDirection.

 <Grid x:Name="LayoutRoot"
        Background="White"
        FlowDirection='RightToLeft'>
    <Grid.RowDefinitions>
      <RowDefinition Height='138*' />
      <RowDefinition Height='162*' />
    </Grid.RowDefinitions>
    <sdk:TabControl   Grid.RowSpan='2'>
      <sdk:TabItem Header='First'>

      </sdk:TabItem>
      <sdk:TabItem Header='Second'>

          <Polyline Points='30,30 160,45 30, 60'
                    Stroke='Orange'
                    StrokeThickness='3' />

      </sdk:TabItem>
      <sdk:TabItem Header='Third'>
        <sdk:Calendar Height='169'
                      Name='calendar1'
                      Width='230'
                      HorizontalAlignment='Left'
                      VerticalAlignment='Top' />
      </sdk:TabItem>
    </sdk:TabControl>

  </Grid>

As you can see, the tab control changes the alignment of the tabs and the order of the child tab items. 

The Polyline correctly changes orientation and the Calendar control reverses the order of the days. All this happens automatically when you change the FlowDirection.

image

image

2 Responses to “Looking for Silverlight BiDi or RTL? Use the FlowDirection property”

  1. Captain Obvious says:

    This was helpful when .NET 3.0 came out. Now, not at all.

  2. [...] Looking for Silverlight BiDi or RTL? Use the FlowDirection Property (Walt Ritscher) [...]