开发者

Changing FlowDirection of a cell in Wpf's DataGrid

开发者 https://www.devze.com 2023-01-25 14:37 出处:网络
I Have a DataGrid with its FlowDirection set to \"RightToLeft\". Problem is when displaying negative numbers, the minus sign is s开发者_开发知识库hown on the opposite side.

I Have a DataGrid with its FlowDirection set to "RightToLeft". Problem is when displaying negative numbers, the minus sign is s开发者_开发知识库hown on the opposite side. Setting the FlowDirection of the cell itself to "LeftToRight" fixes it, but then the left border of the cell moves to the right, so I have no border on the left, and a double border on the right. How can I fix this?


You're gonna have to set FlowDirection on the TextBox rather than on the DataGridCell. If you're 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>
0

精彩评论

暂无评论...
验证码 换一张
取 消