This question is locked. New answers and comments are not allowed.
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
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