Skip to content

Avalonia DataGridColumn WidthProperty binding works differently than the fixed width value #155

@tiborkerenyi

Description

@tiborkerenyi

Describe the bug

If you create a DataGridTemplateColumn from code behind and bind the WidthProperty, the column will adjust to the content. If Width takes a fixed value, it will maintain the width correctly.

To Reproduce

Create a DataGrid in Axaml.
Add content that is wider than the column, but the content wrap works.
From the code behind, add a column with a fixed Width property: the DataGrid will maintain the width.
Rewrite the column generation to WidthProperty binding to the ViewModel value, and the column will follow the width of the content, not the binding value.

Expected behavior

There should be no discrepancy between the two values.

Avalonia version

11.3.6

OS

Windows

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions