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

ScrollIntoViewAsync failing when index is at the last item

2 Answers 98 Views
GridView
This is a migrated thread and some comments may be shown as answers.
theresa
Top achievements
Rank 1
theresa asked on 21 Jun 2017, 07:41 AM

Hi, I got the code from http://docs.telerik.com/devtools/wpf/controls/radgridview/columns/how-to/scroll-item

 

My code :

when DropRowIndex = 16 and the items.count=17 , it calls the scrollFailedCallback , I tried to make it this.timetableGrid.Items[this.timetableGrid.Items.Count -1] and it still fails. WHy? My items count is 17 so it should not be failing. I hardcoded it into DropRowIndex = 15 and it is calling scrollFinishedCallback which is what I want to happen. May I ask why rowindex 16 is not working ?

if (this.timetableGrid.Columns.Count > 0 && DropColIndex <= this.timetableGrid.Columns.Count)
            {
                IsScrollBarForceIntoView = false;
                int offsetCol = 0; int offsetRow = 0;
                if ((DropColIndex + 3) <= (this.timetableGrid.Columns.Count - 1))
                    offsetCol = 3;
                if ((DropRowindex + 3) <= (this.timetableGrid.Items.Count - 1))
                    offsetRow = 3;
                this.timetableGrid.ScrollIntoViewAsync(this.timetableGrid.Items[DropRowindex + offsetRow], //the row
                                this.timetableGrid.Columns[DropColIndex + offsetCol], //the column
                                 new Action<FrameworkElement>((f) =>
                                  {
                                      App.MainWindow.IsBusy = false;
                                  }), new Action ( ()=>
                                      {
                                          App.MainWindow.IsBusy = false;
                                      }
                                    ));
                isDrop = false;
            }
            else
            {
                App.MainWindow.IsBusy = false;
                DropColIndex = 0;
            }

2 Answers, 1 is accepted

Sort by
0
theresa
Top achievements
Rank 1
answered on 22 Jun 2017, 05:32 AM

Anyone?

I tried making it this.timetableGrid.Items.Count-1 but still throws the failed call back. I mean the sample itself is not working in mine.

 The workaround is minus 2 from the actual items. ex. 16-2 = 14th index. It now calls the finished call back but the effect is not desirable as it is not scrolled down to the edge, where I can see the item i need to put in view.

   this.timetableGrid.ScrollIntoViewAsync(this.timetableGrid.Items[this.timetableGrid.Items.Count-1], //the row
                                this.timetableGrid.Columns[this.timetableGrid.Columns.Count-1], //the column
                                 new Action<FrameworkElement>((f) =>
                                  {
                                      App.MainWindow.IsBusy = false;
                                  }), new Action ( ()=>
                                      {
                                          App.MainWindow.IsBusy = false;
                                      }
                                    ));

0
Ivan Ivanov
Telerik team
answered on 22 Jun 2017, 08:58 AM
Hello,

I believe that the behavior that you are reporting is related to a known issue that is currently on our radar. If it is so, the scenario should be operating properly if GroupRenderMode is set to nested. Here is the public item to it, so that you can subscribe and get notified as soon as a fix gets available.

Regards,
Ivan Ivanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
theresa
Top achievements
Rank 1
Answers by
theresa
Top achievements
Rank 1
Ivan Ivanov
Telerik team
Share this question
or