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

SelectedItem in RadCarouselPanel

7 Answers 170 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Ela
Top achievements
Rank 1
Ela asked on 20 Aug 2010, 08:26 PM
Hi,

I've added 7 images to my RadCarouselPanel, as children.

From the MouseLeftButtonUp event, how can I get the selected item (not only the top container, I want to know the currently selected item on the panel)?

Thanks
Ela

7 Answers, 1 is accepted

Sort by
0
Milan
Telerik team
answered on 23 Aug 2010, 08:47 AM
Hello Ela,

Begin a Panel, RadCarouselPanel does not include the notion of selection but you can easily get the image that was clicked. 

void clubsGrid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
    var clickedElement = e.OriginalSource as FrameworkElement;
    var clickedImage = clickedElement.ParentOfType<Image>();
}


Kind regards,
Milan
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
Ela
Top achievements
Rank 1
answered on 23 Aug 2010, 02:41 PM
Thanks Milan.

I tried the provided sample lines, but clickedImage is always NULL. I added the MouseLeftButtonUp event on the Grid. Am I doing something wrong here? Could you please provide me a sample application on this?

Thanks
Ela
0
Milan
Telerik team
answered on 23 Aug 2010, 03:28 PM
Hello Ela,

Sorry for that. Could you please try the following code?

private void Grid_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
{
    var clickedImage = e.OriginalSource as Image;
  
    if (clickedImage != null)
    {
        // image was clicked
    }
}


Kind regards,
Milan
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
Ela
Top achievements
Rank 1
answered on 23 Aug 2010, 04:04 PM
Thanks Milan. This one worked.

However, it's not identifying the correct image in most cases. For example, I'm displaying 7 items on the Panel. 4th item being the Topmost item, if I click on the 3 rd or fifth item, the following lines of codes are returning the correct image pointers.

ClickedImage = e.OriginalSource as Image;
TopImage   = this.radPanel.TopContainer as Image;

However, 4th being the top most item, if I click on the 1,2,6,7 items, these two images are not pointing to the currect clicked/top image in the Panel. i.e. if I click on the 2nd image, ClickedImage points to 1 and TopImage points to 3.

Is that an known issue or I'm doing something woring here?

Thanks
Ela
0
Milan
Telerik team
answered on 24 Aug 2010, 10:41 AM
Hello Ela,

TopImage and ClickedImage need not be one and the same item. TopContainer will give you the item that is in the middle of the carousel while ClickedImage will give you the image that was just clicked. 

If you give us more information about that functionality that you are trying to implement we will be able to provide with more accurate solution. 


Greetings,
Milan
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
Ela
Top achievements
Rank 1
answered on 24 Aug 2010, 02:11 PM
Hi Milan,

I do understand that the TopImage and ClickedImage will point to diffrent items. My issue is, the ClickedImage does not correctly point to the actually clicked one (i.e. if I click on the 2nd item in the carouselpanel, ClickedImage returns the 1st item etc).

My basic requirement is below:
 - I've 7 items to be displayed on the Carousel
- When I set the ItemsPerPage as 7, all the 7 items are getting displayed, with 4 being the TopItem.
- Per the current functionality of RadCarousel and RadCarouselPanel,when I click on a item, it moves that item to the Top and adjust other items. For example, if I click on the 2nd item, it will show the carousel item in  blank-blank-1-2-3-4-5 order. Items 6 and 7 will be hidden (this is because the current path available in Carousel and CarouselPanel is semi-elliptical)
- What I want to achieve is - remove 6 and 7 from the carousel children and add them back as 1 and 2 (to fill in the first two blanks)

- I couldn't achieve it using RadCarousel as it requires assigning the ItemSource (as a List) with all the CarouselItems added in a List. However, I hope this could be done in RadCarouselPanel using the Children.Remove and Children.Insert methods. Please correct me if my assumptions are wrong.

Is it possible to achieve what I'm aiming above? Will it be possible for you to get me a sample app on it? That would be wonderful.

Thanks
Ela
0
Milan
Telerik team
answered on 24 Aug 2010, 04:14 PM
Hi Ela,

As far as I understand you are trying to implement continuous list for the carousel control but unfortunately this feature is almost impossible to implement and look okay with the current RadCarousel/RadCarouselPanel.


Kind regards,
Milan
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
Carousel
Asked by
Ela
Top achievements
Rank 1
Answers by
Milan
Telerik team
Ela
Top achievements
Rank 1
Share this question
or