MaterialDesignInXAML / MaterialDesignInXAML/MaterialDesignInXamlToolkit

Binding errors in DataGrid with ColumnVirtualiztion on

Open
#2,323 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug evaluation required up-for-grabs
Dominant language
C#
Stars
16.3k
Forks
3.5k
Avg merge
1d 22h
Merged PRs (30d)
8

Description

When ColumnVirtualization is on, (or both Row and Column virtualization)

EnableColumnVirtualization="True"

Visual Studio Debugger reports many binding errors in following properties, maybe some other as well:

DataGridCell.Foreground
DataGridColumnHeader.BorderThickness
ListSortDirectionIndicator.Visibility, Name='SortDirectionIndicator'
DataGridColumnHeader.BorderBrush

Those binding throw Exceptions, because they refer with RelativeSource to DataGrid or other grid related elements. I guess that this fails during virtualization magic, when elements are detached from visual tree.
FallbackValue or TargetNullValue don't mitigate this, as error occurs in RelativeSource, so before they come into play.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with EnableColumnVirtualization="True" and inspect the binding definitions for DataGridCell.Foreground, DataGridColumnHeader.BorderThickness, ListSortDirectionIndicator.Visibility, and DataGridColumnHeader.BorderBrush. Done means the listed bindings no longer report exceptions in the Visual Studio debugger when column or row-and-column virtualization is enabled.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.