Version

Setting a Path for xamDataPresenter to Use

In Creating a Named Path on the Artboard, we create a path that we could use to define a custom path for xamCarouselPanel™, xamDataCarousel™, xamDataPresenter’s™ Carousel View or xamCarouselListBox™ to use. The purpose of this topic is to show you how to take that path, and apply it to your xamDataPresenter’s Carousel View.

Note
Note

This topic assumes you already have setup your xamDataPresenter. For more information on how to do this, see Adding xamDataPresenter to Your Application, and have read About CarouselView.

  1. First you need to copy your path you created from your Microsoft® Expression® Blend project into your Visual Studio project. The Window1.xaml is the default window for Blend projects so your path should be defined in this file.

  2. Once you have copied your path, paste it into the resource section of your project.

  3. Doing this will cause an error if you compile it right now. This error occurs because the path is in the resource section, and all items in the resource section must have a Key assigned to them. So specify a Key for your path.

  4. You can remove from the path the Fill, Stretch, and Stroke settings that Blend has set, as the xamDataPresenter won’t need them. You can also leave them if you would like to see the path that your items follow inside the xamDataPresenter.

  5. Below your XamDataPresenter’s CarouselView opening tag, place the following example code. This code creates a ViewSettings, which contains a CarouselViewSettings that has the ItemPath property that you assign your custom path too, by specifying the Key you assigned to the path.

In XAML:

<igDP:CarouselView.ViewSettings>
        <igWindows:CarouselViewSettings ItemPath="{StaticResource myPath}"/>
</igDP:CarouselView.ViewSettings>
  1. If you run the project you will see the xamDataPresenter’s Carousel View items follow the path that you have defined.