FlowDirection in WPF/Silverlight


A colleague of mine illustrated how easy a majority of our work would be in switching our Silverlight application to a bidirectional context layout flow (RTL, rather than LTR).


Path seems to flip X coordinate space automatically based on FlowDirection. at least in WPF 3.5. (I didn't have SL4 handy.) There's no reason I know of for SL4 runtime to break compat with WPF on this, so I expect SL4 is the same.

This XAML:

<Grid FlowDirection="LeftToRight">

<Button Margin="100,0,0,0" Content="Has 'Before' Margin"/>

<Path Stroke="Black" HorizontalAlignment="Left" Data="M58,47 L34,85 L59,120 L58,93 L115,90 L113,72 L59,70 z"/>

</Grid>

Yields a button with left-side margin, and path rendered as I expected (it's an arrow pointing left.)

clip_image002

Change FlowDirection to RightToLeft and you get right-side margin, arrow pointing right. This is all correct for RTL.

clip_image004

Wade

Skip to main content