dotnet / dotnet/wpf

Styles are not updated while binding the DataGrid column’s HeaderTemplate and HeaderStyle using DynamicResource

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

Description

### Description

When assigning a DataGrid column's HeaderTemplate or HeaderStyle with {DynamicResource ...}, the header is not displayed/styled.

```





```

**Note:**
The same templates/styles work correctly when referenced with {StaticResource ...}.
```





```

Please refer the Screenshot for your reference

Image

### Reproduction Steps

1. Run the sample and observe the headers of the two DataGrid columns.
2. The column that uses StaticResource displays the expected header style and template, whereas the column that uses DynamicResource appears unstyled and shows a blank header.

### Expected behavior

The DynamicResource-referenced column header should rendered/styled correctly.

### Actual behavior

The DynamicResource-referenced column header is not rendered/styled correctly.

### Regression?

_No response_

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

_No response_

### Other information

I have attached the sample for your reference.

[DataGrid.zip](https://github.com/user-attachments/files/25963874/DataGrid.zip)

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.