Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
195
Carousel Panel Basics
posted

I'm looking for some docs that describe how to do a few things with the Carousel Panel.

How can I scroll the panel to an item of my choosing?

How can I tell which item in "in front"?

How can I get a message when a user clicks on (selects) an item?

Should I should use a Data Carousel instead? 

Thanks.

Parents
  • 9694
    posted

    Hello Jerome,

    Here are some answers:

    1. The carousel comes with Commands which allow the carousel to be navigated. You can assign one of the commands to a button or control directly. Or you can execute the commands programmatically. For example, to execute the NavigateToNextItem in code-behind for a XmaCarouselPanel named carousel, you would call the following:

    carousel.ExecuteCommand(XamCarouselPanelCommands.NavigateToNextItem);

    2. The carousel does not follow the concept of "in front". Similar to a StackPanel, elements in a XamCarouselPanel are arranged sequentially along a path. If you want to present the items in a XamCarouselPanel in such a way that one item appears to be positioned in front or others in a specific location on the path which will represent the top item, you can easily do that by keeping track of the locations of each item. There are various ways you can approach this. One way is to specify a position on the path based on the number of visible items. You can then use the carousel property FirstVisibleItemIndex to figure out where the list is positioned on the path.

    3. The best way to respond to events when the user clicks on items in the carousel is to assign event handlers to the items in the carousel panel. You can assign an event handler in a style to be assigned to specific types. For example, if you populate the carousel with images, you could respond to mouse down events on every image added to the carousel by adding the following style to the ResourceDictionary in the carousel. In the following snippet, the event points to an event handler: OnItemMouseDown.

    <igWindows:XamCarouselPanel.Resources>
       
    <Style TargetType="{x:Type Image}">
           
    <EventSetter Event="MouseDown" Handler="OnItemMouseDown"/>
    |   
    </Style>
    </igWindows:XamCarouselPanel.Resources>

    C# code-behind:
    private void OnItemMouseDown(object sender, MouseButtonEventArgs e)
    {
    }

    4. The XamCarouselPanel should be sufficient. The XamCarouselListBox will add selection support. The XamDataCarousel is built to present tabular data (such as that found in the XamDataGrid). 

    Incidentally, I am teaching a new public class which Infragistics is offering at various major cities every month, the WPF Boot Camp class. In this class, I go into detail the various WPF features. The class is designed to empower users to better understand and use NetAdvantage for WPF:
    http://es.infragistics.com/training/schedule.aspx#CourseSchedule

    Thanks,

Reply Children
No Data