Subscription to LayoutUpdated
in Loaded
handler solves the problem. In this case IsLoaded
check is also redundant. So, having
public FancyDataGrid() : base()
{
Loaded += OnLoaded;
}
private void OnLoaded(object sender, RoutedEventArgs e)
{
LayoutUpdated += OnLayoutUpdated;
}
instead of
public FancyDataGrid() : base()
{
LayoutUpdated += OnLayoutUpdated;
}
allows to access viewport when it’s calculated with regard to vertical scrollbar.
CLICK HERE to find out more related problems solutions.