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.
This topic contains the following sections:
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.
Install the Infragistics WinForms 2014 Volume 2 or later version of the product.
Start with a new Windows Forms application using Visual Studio 2010 or later version.
This topic assumes that you already have an existing application with UltraCarousel control on the form.
Start with your existing project, and open the form that contains UltraCarousel control in the Visual Studio designer.
Configure the carousel control with desired options, and click the Save
/Save As
button icons on the carousel designer.
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.
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.
Saving and Loading of the user configuration is available in two file formats, XML and Binary.
In C#:
carousel1.SaveAsXml("SaveCarousel.xml");
In Visual Basic:
carousel1.SaveAsXml("SaveCarousel.xml")
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
In C#:
carousel1.SaveAsBinary("SaveCarousel.bin");
In Visual Basic:
carousel1.SaveAsBinary("SaveCarousel.bin")
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
The following topics provide additional information related to this topic.