System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''. BindingExpression:Path=AreRowDetailsFrozen; DataItem=null; target element is 'DataGridDetailsPresenter' (Name=''); target property is 'SelectiveScrollingOrientation' (type 'SelectiveScrollingOrientation') System.Windows.Data Error: 4 : Cannot find source for binding with reference 'RelativeSource FindAncestor, AncestorType='System.Windows.Controls.DataGrid', AncestorLevel='1''. BindingExpression:Path=HeadersVisibility; DataItem=null; target element is 'DataGridRowHeader' (Name=''); target property is 'Visibility' (type 'Visibility')
These errors appear in the immediate window in WPF. Why does this happen, and how can I stop it?
This post here has details of workarounds for this issue. This one worked for me:
Add the following code to global styles:
<Style.Triggers>
<Trigger Property="HeadersVisibility" Value="Column">
<Setter Property="RowHeaderWidth" Value="0" />
</Trigger>
</Style.Triggers>