Skip to content

Bugfix: Column width regression (since C#14 refactor & cleanup)#386

Open
DanielTrommel wants to merge 4 commits into
w-ahmad:mainfrom
DanielTrommel:fix/column-width-regression
Open

Bugfix: Column width regression (since C#14 refactor & cleanup)#386
DanielTrommel wants to merge 4 commits into
w-ahmad:mainfrom
DanielTrommel:fix/column-width-regression

Conversation

@DanielTrommel

@DanielTrommel DanielTrommel commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Description:

Using the latest version, I noticed that vertical grid lines (header <> rows) are mis-aligned when (tab-based) navigating away and later returning back to a TableView, which has columns for which I did not specify Widths.

TableView-GridLinesIssue.mp4

Steps to Reproduce:

  1. In the SampleApp project:

    1. in method ExampleModelColumnsHelper.OnAutoGeneratingColumns() comment out all lines that set the column widths, e.g.:

           //e.Column.Width = new GridLength(60);
      
    2. In GridLinesPage.xaml replace lines 19-21 (the tableview component) with this code:

          <TabView>
              <TabViewItem Header="TableView">
                  <tv:TableView x:Name="tableView"
                                ItemsSource="{Binding Items}"
                                AutoGeneratingColumn="{x:Bind local:ExampleModelColumnsHelper.OnAutoGeneratingColumns}" />
              </TabViewItem>
              <TabViewItem Header="Tabpage for reproduction test">Some text; navigate to here, and back to see if grid lines are still okay</TabViewItem>
          </TabView>
      
  2. Switch the TableView lib project to commit bf62080 or newer

  3. Run the application, and go to the Gridlines example; switch to the "reproduction" tab, and back to the tab with the TableView, and you should see mis-aligned columns

Expected behavior:

Grid lines should always align, ideally with auto-resizing for columns for which no Width was provided.

Contribution:

  • Narrowed it down to the changes in commit bf62080 (refactor for C# 14);
  • The timer logic was removed, and with it the auto calc of the column widths after DesiredWidth updates; restored that code
  • In addition CalculateHeaderWidths() is now also triggered from the OnLoaded, which solves my specific problem (switching away and back to the tab with the TableView)
TableView-GridLines-AutoResize.mp4

Signed-off-by: Daniël Trommel <d.s.trommel@gmail.com>
@DanielTrommel DanielTrommel changed the title Column width regression (since C#14 refactor & cleanup) Bugfix: Column width regression (since C#14 refactor & cleanup) Jun 16, 2026
@DanielTrommel DanielTrommel force-pushed the fix/column-width-regression branch from 667e2eb to 6177479 Compare June 17, 2026 19:59
@DanielTrommel DanielTrommel marked this pull request as draft June 17, 2026 20:07
…nd back to a tab with a tableview, the vertical gridlines form the rows would be misaligned from the header. The call in the OnLoaded fixes this.
@DanielTrommel DanielTrommel force-pushed the fix/column-width-regression branch from 6177479 to db45f31 Compare June 17, 2026 20:24
@DanielTrommel DanielTrommel marked this pull request as ready for review June 17, 2026 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant