SelectedItem in RadCarouselPanel

8 posts, 0 answers
  1. Ela
    Ela avatar
    12 posts
    Member since:
    Jul 2010

    Posted 20 Aug 2010 Link to this post

    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
  2. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 23 Aug 2010 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ela
    Ela avatar
    12 posts
    Member since:
    Jul 2010

    Posted 23 Aug 2010 Link to this post

    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
  5. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 23 Aug 2010 Link to this post

    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
  6. Ela
    Ela avatar
    12 posts
    Member since:
    Jul 2010

    Posted 23 Aug 2010 Link to this post

    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
  7. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 24 Aug 2010 Link to this post

    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
  8. Ela
    Ela avatar
    12 posts
    Member since:
    Jul 2010

    Posted 24 Aug 2010 Link to this post

    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
  9. Milan
    Admin
    Milan avatar
    1989 posts

    Posted 24 Aug 2010 Link to this post

    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
Back to Top
UI for WPF is Visual Studio 2017 Ready