P
P
Pixilys2022-04-08 20:53:54
WPF
Pixilys, 2022-04-08 20:53:54

Autoscroll for DataGrid. How to programmatically scroll to the first line?

There is a table filled with data, the filter works.
The data is taken from the ICollectionView
in the constructor.

SelectedPersons = CollectionViewSource.GetDefaultView(ListPerson);
SelectedPersons.Filter = PersonFiltred;

On an event, Refresh is called.
But the changed scroll position after filtering does not change.
I cannot use the Microsoft.Xaml.Behaviors.Wpf package, there is no NET 6 support.
I found a solution to the issue with an attached property, a variant of the DataGridBehavior type.
" https://stackovergo.com/ru/q/177544/how-to-autoscr... ">
I understand that you need to use Trigger. Bind to an event when the collection has changed or an event to trigger filtering and updating. Or some other?
Only now I’m stacking with triggers for the first time and I don’t understand at all.
How to put it all together and scroll to the first line?
And maybe I'm not on that path at all.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question