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

How to perform an action depending on the selected index

2 Answers 85 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Federico
Top achievements
Rank 1
Federico asked on 31 Dec 2010, 07:45 PM
Good afternoon!

First of all, I want to wish you all @ Telerik a wonderful 2011: Filled with success.

Second, let me thank you for creating this amazing set of WPF & WinForms controls.

Now, to my issue... I am using the WPF 2010 Q3 radcarousel control as a menu for my app: using images to describe each of the 7 avalaible optios. Now, the problem is that I can not find any method like a "selectedIndex()" one, that would allow me to perform a determined action depending on the user's selection, (tho I have tried in several ways). Is there a way for doing so?

Thank you so much in advance and my best wishes to everybody!

WPF version: 2010 Q3.
OS: Windows 7 Pro.
Preferred programming language is C#

2 Answers, 1 is accepted

Sort by
0
Accepted
Ivan Ivanov
Telerik team
answered on 03 Jan 2011, 08:27 AM
Hi Federico,

You may try such an approach:
Let we have a carousel with an ItemSource set to a List<BusinessObject>. You may listen to the SelectionChanged event of RadCarousel and determining the index of the SelectedItem, by mapping it to its index in the ItemSource:

int id = ((List<BusinessObject>)carousel.ItemsSource).IndexOf((BusinessObject)carousel.SelectedItem);

you may invoke your custom method based on this value.

Sincerely,
Ivan Ivanov
the Telerik team
Browse the videos here>> to help you get started with RadControls for WPF
0
Federico
Top achievements
Rank 1
answered on 03 Jan 2011, 05:42 PM
Thank you so much for your reply, Ivan Ivanov!!!.

Worked perfectly :D

Wishing you an awesome year,

Federico Prado :)
Tags
Carousel
Asked by
Federico
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
Federico
Top achievements
Rank 1
Share this question
or