Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

[TreeDataGrid] Row selection needs improving #371

Open

Description

@clintsinger

Describe the bug

On the TreeDataGrid when one clicks on a row it will only be selected if the user clicks on the rendered column element. For example, if using a TextColumn only clicking on the text will cause the row to select. One should be able to select any part of the row to select it.

To Reproduce

  1. Create a TreeDataGrid with any number of columns.
  2. Click on the white space of the row
  3. Observe that the row is not selected.
  4. Click on the rendered element, such as the text in a column
  5. Observe that the row is selected.

Expected behavior

One should be able to click on any part of a row to select it.

Avalonia version

Avalonia: 11.3.0, Avalonia.Controls.TreeDataGrid: 11.1.1

OS

No response

Additional context

No response

Activity

  1. added
    bug
    on May 30, 2025
  2. maxkatz6 commented on May 30, 2025

    @maxkatz6
    Member

    Do you use Fluent theme with Fluent theme styles of TreeDataGrid?
    By default, TreeDataGridRow should have a transparent (not null) background, which then can be hittested and trigger selection.

  3. maxkatz6 commented on May 30, 2025

    @maxkatz6
    Member

    Actually, I don't see background actually having a value there: https://github.com/AvaloniaUI/Avalonia.Controls.TreeDataGrid/blob/master/src/Avalonia.Controls.TreeDataGrid/Themes/Generic.axaml#L159-L161

    Should be an easy fix/workaround by setting a background on the row.

  4. clintsinger commented on May 30, 2025

    @clintsinger
    Author

    So it turns out I wasn't using the default theme (I had placed it in the wrong part of my app.xaml... I'm still new).

    It would still be great if it would work correctly without the theme. Perhaps that's what you are proposing above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions