dotnet / dotnet/wpf

set `TextBlock.TextAlignment` to `Right` in `DataGridTextColumn.ElementStyle` will cause text overflow to right edge

Open
#11,394 8 comments 1 reaction 0 assignees View on GitHub
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

set `TextBlock.TextAlignment` to `Right` in `DataGridTextColumn.ElementStyle` will cause text overflow to right edge.

Image

two thing can eliminate this:
1. drag move to change column width
Image

2. when content longer than header
Image

### Reproduction Steps

Create a `.net9.0-windows` `wpf` project, and make a `DataGrid` like this:
```xaml





<Setter Property="Background" Value="CornflowerBlue"></Setter><!--for check-->
<Setter Property="TextAlignment" Value="Right"></Setter>





0

```

### Expected behavior

Image

### Actual behavior

see description.

### Regression?

I don't know

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

`.net9.0-windows` wpf project
windows 10 22H2 x64 chinese lang

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.