Change FlowDirection Cells in Wpf DataGrid

I have a DataGrid with its FlowDirection set to "RightToLeft". The problem is the display of negative numbers, the minus sign is displayed on the opposite side. Setting the FlowDirection of the cell itself to "LeftToRight" corrects it, but then the left border of the cell moves to the right, so I don’t have a border on the left and a double border on the right. How can i fix this?

+5
source share
1 answer

You will need to set the FlowDirection to a TextBox, not a DataGridCell. If you are using a DataGridTextColumn, then

<DataGridTextColumn ...>
    <DataGridTextColumn.ElementStyle>
        <Style TargetType="TextBlock">
            <Setter Property="FlowDirection" Value="LeftToRight" />
        </Style>
    </DataGridTextColumn.ElementStyle>
    <DataGridTextColumn.EditingElementStyle>
        <Style TargetType="TextBox">
            <Setter Property="FlowDirection" Value="LeftToRight" />
        </Style>
    </DataGridTextColumn.EditingElementStyle>
</DataGridTextColumn>
+5
source

All Articles