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

Scroll item when Mouse over

7 Answers 46 Views
Carousel
This is a migrated thread and some comments may be shown as answers.
Hema
Top achievements
Rank 1
Hema asked on 12 Apr 2016, 07:15 AM

Hi Team,

 

I have requirement to scroll item when user place the mouse over left or right item from RadCarousel control. Please let me know how to do ?

 

Regards

Hema

7 Answers, 1 is accepted

Sort by
0
Dilyan Traykov
Telerik team
answered on 14 Apr 2016, 10:35 AM
Hello Hema,

One way to approach this would be to predefine the CarouselItem's ControlTemplate and handle ContentPresenter's MouseEnter and MouseLeave events. I've attached a sample project to demonstrate this.

Please let me know if this would work for you.

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Hema
Top achievements
Rank 1
answered on 29 Apr 2016, 11:16 AM

Hi Dilyan,

 

Thanks for your reponse. also sorry for late reply.

I have found some issue in Carousel control, if the list has 2 item then its showing blank screen/ data appearing after scroll mouse.

Attached the code for your reference. 

 

Regards

Hema

0
Dilyan Traykov
Telerik team
answered on 03 May 2016, 07:58 AM
Hello Hema,

The behavior you're observing is due to the fact that the ItemsPerPage property of the RadCarouselPanel is set to 3. RadCarousel will not automatically fill its path with items if the number of items is less than the value of the ItemsPerPage property.

You can have a look at the following forum thread where a similar scenario has been discussed. Another possible solution has been suggested here by one of my colleagues.

I hope you find this information helpful.

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Hema
Top achievements
Rank 1
answered on 13 Jun 2016, 04:25 AM

Hi Dilyan,

Thanks for your reply.

I want get the Preview item when the user mouse over. for example if the user mouse cursor top of the preview item then it should be selected item and do some business.

I just checked rad carousel has mouse double clicked event and it does not have mouse over or mouse leave events. can you help on my requirement?

Regars

Hema

 

 

 

 

0
Dilyan Traykov
Telerik team
answered on 13 Jun 2016, 10:10 AM
Hello Hema,

Please refer to the project I've attached to one of my previous replies. As demonstrated there, you can access the carousel item and then you can get the underlying business object like so:

private void CarouselItem_MouseEnter(object sender, MouseEventArgs e)
{
    var target = e.Source as FrameworkElement;
    var carouselItem = target.ParentOfType<CarouselItem>();
 
    if (!carouselItem.IsSelected)
    {
        carouselItem.IsSelected = true;
        var club = carouselItem.DataContext as Club;
        MessageBox.Show(club.Name);
    }
}

Please let me know if this suits your requirements.

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Hema
Top achievements
Rank 1
answered on 16 Jun 2016, 02:28 AM

Above your example shows navigating the item when mouse over to left and right items. but my requirement is very simple. i want to get the item index when user mouse over the center item from carousel(like preview item). when carouselitem.isselected=true is navigate item and not able to get either user mouse over on left or right or center of my items(club)

 

Regards

Hema

 

0
Accepted
Dilyan Traykov
Telerik team
answered on 17 Jun 2016, 11:35 AM
Hello Hema,

In such case, you can handle this like so:

if (carouselItem.IsSelected)
{
    var club = carouselItem.DataContext as Club;
    MessageBox.Show(club.Name);
}

Bear in mind that you will need to leave and reenter the carousel item with your mouse for this to work and thus, remove the logic for the CarouselItem_MouseLeave event as right now it sets the item's IsSelectedproperty to false.

Or, depending on your requirements you can simplify the whole handler to:

private void CarouselItem_MouseEnter(object sender, MouseEventArgs e)
{
    var target = e.Source as FrameworkElement;
    var carouselItem = target.ParentOfType<CarouselItem>();
 
    carouselItem.IsSelected = true;
 
    var club = carouselItem.DataContext as Club;
    MessageBox.Show(club.Name);
}

I hope you find this helpful.

Regards,
Dilyan Traykov
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Tags
Carousel
Asked by
Hema
Top achievements
Rank 1
Answers by
Dilyan Traykov
Telerik team
Hema
Top achievements
Rank 1
Share this question
or