Skip to content

Add TableViewColumn.IsVisible property - #22162

Open
OleRoss wants to merge 5 commits into
AvaloniaUI:mainfrom
OleRoss:feat/add-table-view-isvisible
Open

Add TableViewColumn.IsVisible property#22162
OleRoss wants to merge 5 commits into
AvaloniaUI:mainfrom
OleRoss:feat/add-table-view-isvisible

Conversation

@OleRoss

@OleRoss OleRoss commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

What does the pull request do?

Since I would really like to see the TableViewColumn have an IsVisible property, I thought I'd go ahead and prepare a small PR for it.

What is the current behavior?

There is no IsVisible property on a TableViewColumn, so when columns are defined in axaml, you must set the width either in code-behind or using a custom converter.

What is the updated/expected behavior with this PR?

TableViewColumn now has an IsVisible property, matching the existing DataGrid/TreeDataGrid solutions for dotnet and user expectations.

How was the solution implemented (if it's not obvious)?

  • The width is only calculated for columns that are visible
  • The width of a hidden column is not updated
  • When attaching a column, its logical parent is now set before its TableView reference. This lets styles and inherited bindings resolve before they can trigger refreshes on cells and headers that haven't been rebuilt yet.

Some considerations I had regarding performance: I was not sure if it makes sense to call RefreshHeader/RefreshCell on an ' IsVisible change. Those methods seem to pull the latest value for all the column's properties and update bindings, which isn't really necessary when only updating IsVisible. But I kept it simple and didn't introduce a separate refresh path in this PR.

Note: Some tests were implemented by AI and include edge cases found by the reviewer.

Checklist

Breaking changes

  • None I am aware of

Obsoletions / Deprecations

Fixed issues

Closes #21818.

@MrJul MrJul self-assigned this Sep 7, 2026
@avaloniaui-bot

Copy link
Copy Markdown

You can test this PR using the following package version. 12.2.999-cibuild0069513-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add TableViewColumn.IsVisible property

3 participants