Thanks for contacting Syncfusion Support.
We have analyzed your query ”GetVisualContainer returns null when SfDataGrid is not on first tab” and the provided sample from our side. We regret to let you know that you can get the VisualContainer only when the DataGrid is visible.
However you can resolve this by adding null check before using the GetVisualContainer method. SfDataGrid.Loaded event will again raise when switching to the tab containing the SfDataGrid.
sfDataGrid.Loaded += SfDataGrid_Loaded;
private void SfDataGrid_Loaded(object sender, RoutedEventArgs e)
if (sfDataGrid.GetVisualContainer() != null)
sfDataGrid.GetVisualContainer().ScrollOwner.ScrollChanged += ScrollOwner_ScrollChanged;
private void ScrollOwner_ScrollChanged(object sender, ScrollChangedEventArgs e)
We have attached the modified sample for your reference and you can download the same from the following location
Please let us know if you would require further assistance.