Search code examples
.netwpflocalizationglobalizationright-to-left

Round brackets not showing up correctly in RightToLeft flow direction in WPF


Flow direction in my WPF window is set to RightToLeft like so:

<TextBlock FlowDirection="RightToLeft" x:Name="test">

In code if I do test.Text = "(2/3)"; I see

(2/3)

But if I do test.Text = "asdf (2/3)"; I see

(asdf (2/3

What's going on here? Why is it that starting the text with a string changes the positioning of the brackets?


Solution

  • I am not sure, but another more complex workaround is:

    Friday, February 12, 2010 5:10 PM Ben Ronco - MSFT

    Unfortunately this is a bug that we have recently discovered. You may be able to work around this issue by puttting some "invisible" non punctuation text at the end of your content like this:

    {example modified}
    
    <TextBlock FlowDirection="RightToLeft" x:Name="test">                    
        <Run>Label1 (cms)</Run>
        <Run FontSize=".01">i</Run>
    </TextBlock> 
    

    Source: http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/3a723659-2bac-4d0c-80d8-09ba38e6cec1