在Wpf的DataGrid中更改单元格的FlowDirection

vis*_*tud 5 wpf datagrid wpftoolkit wpfdatagrid

我有一个DataGrid,其FlowDirection设置为"RightToLeft".问题是当显示负数时,减号显示在另一侧.将单元格本身的FlowDirection设置为"LeftToRight"可以修复它,但是单元格的左边框向右移动,所以左边没有边框,右边有双边框.我怎样才能解决这个问题?

Fre*_*lad 5

您将不得不在TextBox而不是DataGridCell上设置FlowDirection.如果您正在使用DataGridTextColumn

<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>
Run Code Online (Sandbox Code Playgroud)