This is a migrated thread and some comments may be shown as answers.

Programmatically change filter and ScrollItemIntoViewAsync

2 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Mats
Top achievements
Rank 1
Mats asked on 01 Aug 2019, 09:50 AM

Hi

I have a function that changes two properties. Using MVVM.

  1.     FilterDescriptors => that updates the GridView.FilterDescriptors by a DepedencyProperty
  2.     ScrollItem => that uses GridView.ScrollIntoViewAsync by a DepedencyProperty

Both working fine if i set a property one at a time. If i run them in same function the order is still right of calling the DependencyProperties.
Although the ScrollIntoViewAsync gives a ScrollFailedCallback in this scenario and it is not scrolled to the item.

My guess is that the items are still filtered, hence it cannot be scrolled to the desired item.

 

Any ideas to solve this?
Thank you in advance

 

2 Answers, 1 is accepted

Sort by
0
Accepted
Vladimir Stoyanov
Telerik team
answered on 06 Aug 2019, 08:00 AM
Hello Mats,

What I can suggest for you to try in order to make sure that the grid is updated before the scrolling is to wrap the ScrollIntoViewAsync call into a Dispatcher. You can also reduce the DispatcherPriority, if needed (for example to Loaded). Please, give this approach a try and let me know, if you find it helpful.

Regards,
Vladimir Stoyanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Mats
Top achievements
Rank 1
answered on 08 Aug 2019, 02:01 PM

Thank you Vladimir !

It helped using wrap it into a Dispatcher and set DispatcherPriority to Input.

 

Cheers Mats

Tags
GridView
Asked by
Mats
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Mats
Top achievements
Rank 1
Share this question
or