Skip to content

Button in DataGrid Header causes application to crash #4898

Open
@amercer-fdi

Description

@amercer-fdi

Describe the bug

When creating a DataGridTextColumn, adding a Button tag causes the entire application to crash during rendering. Example:

Regression

No response

Reproducible in sample app?

  • This bug can be reproduced in the sample app.

Steps to reproduce

1. Create a new WinUI 3 application, and add a DataGrid control.
`
<controls:DataGrid
   x:Name="DataGrid"
   ...
/>
  1. Add a text column and insert a button in the header
<controls:DataGridTextColumn>
    <controls:DataGridTextColumn.Header>
        <Button>Test</Button>
    </controls:DataGridTextColumn.Header>
</controls:DataGridTextColumn>


### Expected behavior

A button should appear in the header.

### Screenshots

_No response_

### Windows Build Number

- [ ] Windows 10 1809 (Build 17763)
- [ ] Windows 10 1903 (Build 18362)
- [ ] Windows 10 1909 (Build 18363)
- [ ] Windows 10 2004 (Build 19041)
- [ ] Windows 10 20H2 (Build 19042)
- [ ] Windows 10 21H1 (Build 19043)
- [X] Windows 11 21H2 (Build 22000)
- [ ] Other (specify)

### Other Windows Build number

_No response_

### App minimum and target SDK version

- [ ] Windows 10, version 1809 (Build 17763)
- [ ] Windows 10, version 1903 (Build 18362)
- [ ] Windows 10, version 1909 (Build 18363)
- [ ] Windows 10, version 2004 (Build 19041)
- [ ] Other (specify)

### Other SDK version

_No response_

### Visual Studio Version

2022

### Visual Studio Build Number

Version 17.5.0 Preview 4.0

### Device form factor

Desktop

### Nuget packages

_No response_

### Additional context

_No response_

### Help us help you

No.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DataGrid 🔠Issues on DataGrid controlbug 🐛An unexpected issue that highlights incorrect behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions