SlideViewItem resets it's state after multiple swipes

2 posts, 0 answers
  1. Bharat
    Bharat avatar
    1 posts
    Member since:
    Aug 2013

    Posted 08 Feb 2014 Link to this post

    I'm currently developing a flashcards application with the Telerik SlideView control on Windows Phone 8. The ItemTemplate for my SlideView control is a UserControl I created that has a Rectangle and two Textboxes, basically mimicking a flashcard. I have two VisualStates for the UserControl, a "Normal" state where the first side of the flashcard is displayed, and a "Flipped" state where the card is flipped and the definition side of the flashcards is displayed. My UserControl is pre-styled and the "Normal" VisualState is the exact same thing as that style, I just use the Normal VisualState to easily have a flip animation between the Flipped and Normal states. When I open up a flashcards set in my app, the ItemsSource for the SlideView is set to the list of flashcards within the flashcards set and I can then scroll through all my flashcards within that set by swiping left and right. When I tap on a flashcard, my VisualState is changed and the back of my flashcard is shown. Assuming I tap on a flashcard once to show the back of the card and then I swipe once to the right or left, and then swipe back, that flashcard's state would be preserved and it would still show the back of the flashcard. However if I tap on the card to show the back and then swipe more than one time to either side and then swipe back to my original flashcard, it would reset back to it's original state showing the front of the flashcard. I don't know if this is by design or not, but the idea that the state of my SlideViewItem resets itself after a few swipes ruins a key element of the functionality I wish to implement in my app. Is there any way to manipulate the control so the state of my SlideViewItems are all preserved no matter how many times I cycle through all my flashcards?
  2. Todor
    Admin
    Todor avatar
    778 posts

    Posted 13 Feb 2014 Link to this post

    Hi Bharat,

    Thank you for writing.

    RadSlideView uses visual containers to display its items. These containers are reused so that at one point only 3 items are loaded. This is necessary because very often the control displays many images, which would cause OutOfMemoryException if they were loaded simultaneously. 

    In order to achieve your desired behavior, you can add a Boolean property which keeps information about whether the card is flipped or not. This way when a certain item needs to be displayed, you will be able to use the value of your property to correctly determine whether the card should be flipped or not.

    I hope this information helps. Don't hesitate to write back if you have other questions.

    Regards,
    Todor
    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.
  3. DevCraft banner
Back to Top