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

Transition Control With Item Select Ability

3 Answers 51 Views
TransitionControl
This is a migrated thread and some comments may be shown as answers.
Fletcher Aluminium
Top achievements
Rank 1
Fletcher Aluminium asked on 09 Aug 2010, 11:35 PM
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

3 Answers, 1 is accepted

Sort by
0
Pana
Telerik team
answered on 10 Aug 2010, 09:52 AM
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
0
Fletcher Aluminium
Top achievements
Rank 1
answered on 10 Aug 2010, 10:04 PM
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
0
Pana
Telerik team
answered on 11 Aug 2010, 08:18 AM
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
Tags
TransitionControl
Asked by
Fletcher Aluminium
Top achievements
Rank 1
Answers by
Pana
Telerik team
Fletcher Aluminium
Top achievements
Rank 1
Share this question
or