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.
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://ko.infragistics.com/training/schedule.aspx#CourseSchedule
Thanks,
code behind is so dirty and ugly!
please give us an example with ViewModel/Command.
Thx
Currently I have a WPF application that uses tabs that in turn have buttons under each tab. The tabs just have text on them and I would like to have a carousel in place of the tabs, would a panel carousel make sense? The idea would be to select a carousel item which then would show the buttons that were shown under a tab. This makes sense? Also I have seen any examples of using an Infragistics carousel control.
Hi, I am working to acomplish the same functionality (bring the clicked item to the center of the path) I have identified a couple issues with it:
any help would be apreciated.
David