Version

Save/Load Carousel Layout

Topic Overview

Purpose

This topic demonstrates how to Save/Load the UltraCarousel layout including carousel items, unless the control is bound to data. In that case the control has to be re-bound after loading the saved layout.

In this topic

This topic contains the following sections:

Overview

Introduction

The UltraCarousel control allows to save and load the user configuration in code and design-time. The configuration dialog contains additional options to include/exclude elements for saving.

Note
Note:

The saved configuration will include the items, unless the control is bound to data. In that case it would be necessary to re-bind the control after loading the previously saved configuration.

Application Requirements

  1. Install the Infragistics WinForms 2014 Volume 2 or later version of the product.

  2. Start with a new Windows Forms application using Visual Studio 2010 or later version.

Design-time Save/Load

This topic assumes that you already have an existing application with UltraCarousel control on the form.

  1. Start with your existing project, and open the form that contains UltraCarousel control in the Visual Studio designer.

  2. Configure the carousel control with desired options, and click the Save/Save As button icons on the carousel designer.

  3. In the popup window you have options to save all or selectively, and also file format ( XML or Binary ), then click Save on the popup dialog.

SaveLoad Carousel Configuration 1.png

To Load previously saved configuration, simply click the “Open” folder icon in the configuration dialog and navigate to the location of the saved file, and open.

In-Code Save/Load

Saving and Loading of the user configuration is available in two file formats, XML and Binary.

Saving as XML file:

In C#:

carousel1.SaveAsXml("SaveCarousel.xml");

In Visual Basic:

carousel1.SaveAsXml("SaveCarousel.xml")

Loading from XML file:

In C#:

if (File.Exists("SaveCarousel.xml"))
{
    using (Stream file = File.OpenRead("SaveCarousel.xml"))
    {
        carousel1.LoadFromXml("SaveCarousel.xml");
    }
}

In Visual Basic:

If File.Exists("SaveCarousel.xml") Then
      Using file__1 As Stream = File.OpenRead("SaveCarousel.xml")
            carousel1.LoadFromXml("SaveCarousel.xml")
      End Using
End If

Saving as Binary file:

In C#:

carousel1.SaveAsBinary("SaveCarousel.bin");

In Visual Basic:

carousel1.SaveAsBinary("SaveCarousel.bin")

Loading from Binary file:

In C#:

if (File.Exists("SaveCarousel.bin"))
{
    using (Stream file = File.OpenRead("SaveCarousel.bin"))
    {
        carousel1.LoadFromBinary("SaveCarousel.bin");
    }
}

In Visual Basic:

If File.Exists("SaveCarousel.bin") Then
      Using file__1 As Stream = File.OpenRead("SaveCarousel.bin")
            carousel1.LoadFromBinary("SaveCarousel.bin")
      End Using
End If

Related Content

Topics

The following topics provide additional information related to this topic.

Topic Purpose

This topic demonstrates how to add UltraCarousel items using the Code-Behind.

This topic demonstrates how to add and configure the UltraCarousel items using the control’s design-time interface.

This topic demonstrates binding data to the UltraCarousel in code-behind.

This topic will demonstrate with steps, how to set up a data source at design-time, and bind it to the UltraCarousel control.