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

InvalidOperationException while trying to scroll programmatically

3 Answers 38 Views
DataBoundListBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nik
Top achievements
Rank 1
Nik asked on 31 Jan 2014, 06:59 AM
Hello!

I need to automate the UI testing of my app, and one of the cases is scrolling a DataBoundListBox automatically. Since its Automation Peer doesn't support scrolling, i manually get the ScrollViewer from the control and scroll it automatically via ScrollProvider.Scroll. The problem is the following:
1) If I use static DataBoundListBox initialization (i.e. declare the content in the .xaml file) it works fine. 
2) If I try the same approach with dynamic content (setting listbox.ItemSource to an ObservableCollection) it only works after I manually start scrolling the list. What I mean is if (1) I open the app on the emulator, scroll the ListBox for any amount with my mouse and then press the "Automate Scroll" button it scrolls the ListBox. If, on the other hand, (2) I open the app on the emulator and press the "Automate Scroll" button I get a InvalidOperationException. It seems as if the content is not yet loaded, and it initializes correctly after I scroll manually with my mouse. 

Is there any way to programmatically load the dynamic content of the DataBoundListBox before trying to scroll it via the ScrollViewers Automation Peer?

Regards,
Nick

3 Answers, 1 is accepted

Sort by
0
Nik
Top achievements
Rank 1
answered on 31 Jan 2014, 07:02 AM
I'm so sorry, this is supposed to be in the WinPhone 8 section. I can't seem to delete this post myself.
0
Accepted
Deyan
Telerik team
answered on 03 Feb 2014, 09:31 AM
 Hi Nik,

Scrolling programmaticaly is not officially supported on RadDataBoundListBox as of now. Please consider implementing tests that do manual scrolling (via an automated gesture), instead of calling Scroll.

Regards,
Deyan
Telerik
If you want to get updates on new releases, tips and tricks and sneak peek previews directly from the developers working on the UI for Windows Phone, subscribe to the blog feed now.
0
Nik
Top achievements
Rank 1
answered on 03 Feb 2014, 09:38 AM
Hello Deyan!

Thanks for your reply. I'll try to find some workaround, since I'm planning to automatically test my app on a real device, and Microsoft doesn't provide a way of simulating a touch input. 

Best regards, 
Nik
Tags
DataBoundListBox
Asked by
Nik
Top achievements
Rank 1
Answers by
Nik
Top achievements
Rank 1
Deyan
Telerik team
Share this question
or