InvalidOperationException while trying to scroll programmatically

4 posts, 1 answers
  1. Nik
    Nik avatar
    3 posts
    Member since:
    Jan 2014

    Posted 31 Jan 2014 Link to this post

    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
  2. Nik
    Nik avatar
    3 posts
    Member since:
    Jan 2014

    Posted 31 Jan 2014 Link to this post

    I'm so sorry, this is supposed to be in the WinPhone 8 section. I can't seem to delete this post myself.
  3. DevCraft banner
  4. Answer
    Deyan
    Admin
    Deyan avatar
    2038 posts

    Posted 03 Feb 2014 Link to this post

     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.
  5. Nik
    Nik avatar
    3 posts
    Member since:
    Jan 2014

    Posted 03 Feb 2014 in reply to Deyan Link to this post

    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
Back to Top