How to perform an action depending on the selected index

3 posts, 1 answers
  1. Federico
    Federico avatar
    2 posts
    Member since:
    Dec 2010

    Posted 31 Dec 2010 Link to this post

    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. Answer
    Ivan Ivanov
    Ivan Ivanov avatar
    1218 posts

    Posted 03 Jan 2011 Link to this post

    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.

    Ivan Ivanov
    the Telerik team
    Browse the videos here>> to help you get started with RadControls for WPF
  3. Federico
    Federico avatar
    2 posts
    Member since:
    Dec 2010

    Posted 03 Jan 2011 Link to this post

    Thank you so much for your reply, Ivan Ivanov!!!.

    Worked perfectly :D

    Wishing you an awesome year,

    Federico Prado :)
Back to Top