Transition Control With Item Select Ability

4 posts, 0 answers
  1. Fletcher Aluminium
    Fletcher Aluminium avatar
    18 posts
    Member since:
    Jun 2010

    Posted 09 Aug 2010 Link to this post

    Hi there,

    I am currently using the http://demos.telerik.com/silverlight/#TransitionControl/FirstLook example as my base for creating a banner at the top of my Silverlight web page.  I currently have it set up so that on a timer control, every 4 seconds, it will change to the next to image, but using the selectNext method of the PagerViewModel class.  I also have it set up, so that when I mouse over the buttons to change between images (I have removed to backwards and forwards buttons which come with the example) the timer is paused so that you can then select which image you would like to view instead of constantly cycling through it.

    However, herein lies my problem.  At the moment, the user needs to click on the button to change to that image, I would rather have the user be able to hover their mouse over the button and pause the timer and show the image thats wanted.  Now, I have tried to implement this, by changing the base class of PageViewModel to inherit from ListBoxItem, ContentControl, ContentPresenter, UserControl, however, none of these work, as I end up getting an unhandled exception of "ArgumentException was unhandled by user code: Value does not fall within the expected range.".  The callstack for this exception is the protected virtual void OnPropertyChanged(PropertyChangedEventArgs args) event of the PagerViewModel class.

    If I remove the inherit from the PageViewModel class then everything works fine.

    The reason that I want to inherit from one of those types, is that it gives me access to the MouseEnter and MouseLeave events, that I can then add a handler too at run time.  Any help would be great.  Thanks very much.

    Shaun Sharples
  2. Pana
    Admin
    Pana avatar
    748 posts

    Posted 10 Aug 2010 Link to this post

    Hi Shaun,

    The ViewModel is not a Control and it should not be.

    You could create a boolean IsTimerRunning property on the PagerViewModel that when set to false resets the timer and when set to true start the timer from 0.

    On MouseEnter on the buttons or on some other control that has all the navigation items you could set the IsTimerRunning to false and on MouseLeave you could set it to true.

    Best wishes,
    Panayot
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Fletcher Aluminium
    Fletcher Aluminium avatar
    18 posts
    Member since:
    Jun 2010

    Posted 10 Aug 2010 Link to this post

    Thanks for your speedy response Panayot, I will look into that.  Is there any way in which I could get the index of the image, from the buttons on the mouseEnter event.  So that way I could show the image that the user mouses over instead of having to click it?

    Cheers,

    Shaun
  5. Pana
    Admin
    Pana avatar
    748 posts

    Posted 11 Aug 2010 Link to this post

    Hello Shaun,

    The DataContext of the ListBoxItems will be an item from the PageViewMode. You can extend the view model so the items have knowledge of their 'parent' and implement a Select() method on them. Then you could create an element in the ItemTemplate of the ListBox that on MouseEnter will call Select() on its DataContext.

    Best wishes,
    Panayot
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top