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.

TreeDataGridRow style selector: Binding to self logs a null datacontext error #352

Open

Description

@DigVolSoft

Binding a setter for the TreeDataGridRow style selector works fully, but throws an error in the log everytime a new row scrolls into view.

 <Style Selector="TreeDataGridRow" >
   <Setter Property="BorderBrush" Value="Silver" />
   <Setter Property="Background" Value="{Binding $self.((vm:MyFile)DataContext).RowType,Mode=OneWay, Converter={StaticResource RowBackgroundConverter}}"/>
 </Style>

Errors:

[Binding]An error occurred binding 'Background' to 'DataContext.RowType' at 'DataContext': 'Value is null.' (TreeDataGridRow #13884972)
[Binding]An error occurred binding 'Background' to 'DataContext.RowType' at 'DataContext': 'Value is null.' (TreeDataGridRow #5772232)

I assume it is logging the error before the new container gets given the datacontext. Possibly similar to this old issue: AvaloniaUI/Avalonia#5762

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions