Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CheckBox tick mirrored when changing FlowDirection

Tags:

wpf

O.S. : Microsoft Windows 8.1 Developing Application: Microsoft Visual Studio 2013 (WPF App development)

I have moved from Windows 7 to Windows 8.1 and now my old apps which i had developed in VS2012 have a weird manner. because my language is right-to-left, i use RightToLeft for FlowDirection. it was working fine as all text was showing on the left side of CheckBox but now the tick sign of CheckBox is mirrored like this:

enter image description here

the tick sign is not correct even in a right-to-left language. is this because O.S. or the VS2013 and how can i fix it? do i need to create a template? thanks.

like image 955
Hossein Amini Avatar asked Jun 14 '14 06:06

Hossein Amini


2 Answers

I had the same problem, and this is the best solution i found. The path is what draws the tick, so just changing its flow direction back to LeftToRight makes it draw as you would expect.

<CheckBox Content="My Checkbox" FlowDirection="RightToLeft">
    <CheckBox.Resources>
         <Style TargetType="{x:Type Path}">
               <Setter Property="FlowDirection" Value="LeftToRight"/>
         </Style>
    </CheckBox.Resources>
</CheckBox>
like image 167
emybob Avatar answered Nov 16 '22 20:11

emybob


<Grid>
    <Grid.Resources>
        <Style x:Key="ArabicStyle" TargetType="{x:Type CheckBox}">
            <Style.Resources>
                <Style TargetType="{x:Type Path}">
                    <Setter Property="FlowDirection" Value="LeftToRight"/>
                </Style>
            </Style.Resources>
        </Style>
    </Grid.Resources>
    <CheckBox Content="My Checkbox:" Style="{StaticResource ArabicStyle}"/>
</Grid>
like image 23
Martin Qi Avatar answered Nov 16 '22 19:11

Martin Qi