Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DigVolSoft opened this issue Apr 3, 2025 · 0 comments

Comments

@DigVolSoft
Copy link

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

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

No branches or pull requests

1 participant