Infragistics(R) NetAdvantage(R) Windows Forms
LayoutsCollection Class
Members  Example  See Also  E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace : LayoutsCollection Class

A collection of Layouts.

Syntax

Visual Basic (Declaration) 
Public Class LayoutsCollection 
   Inherits Infragistics.Shared.KeyedSubObjectsCollectionBase
C# 
public class LayoutsCollection : Infragistics.Shared.KeyedSubObjectsCollectionBase 

Example

Following code shows how to use Layouts property to create and store layouts.

Visual BasicCopy Code
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button10_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button10.Click

      ' Add a new layout to the layouts collection.
      Me.ultraGrid1.Layouts.Add("L1")
      Me.ultraGrid1.Layouts.Add("L2")

      ' Setup the "L1" layout.
      Me.ultraGrid1.Layouts("L1").Override.CellAppearance.BackColor = Color.Maroon
      Me.ultraGrid1.Layouts("L1").Override.CellAppearance.ForeColor = Color.White

      ' Setup the "L2" layout.
      Me.ultraGrid1.Layouts("L2").Override.CellAppearance.BackColor = Color.LightSkyBlue
      Me.ultraGrid1.Layouts("L2").Override.CellAppearance.ForeColor = Color.DarkBlue

      ' Copy the "L1" layout to the layout of the ultraGrid1 and "L2" layout to the layout 
      ' of ultraGrid2's.
      Me.ultraGrid1.DisplayLayout.CopyFrom(Me.ultraGrid1.Layouts("L1"))
      Me.ultraGrid2.DisplayLayout.CopyFrom(Me.ultraGrid1.Layouts("L2"))

  End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button10_Click(object sender, System.EventArgs e)
{

	// Add a new layout to the layouts collection.
	this.ultraGrid1.Layouts.Add( "L1" );
	this.ultraGrid1.Layouts.Add( "L2" );

	// Setup the "L1" layout.
	this.ultraGrid1.Layouts["L1"].Override.CellAppearance.BackColor = Color.Maroon;
	this.ultraGrid1.Layouts["L1"].Override.CellAppearance.ForeColor = Color.White;

	// Setup the "L2" layout.
	this.ultraGrid1.Layouts["L2"].Override.CellAppearance.BackColor = Color.LightSkyBlue;
	this.ultraGrid1.Layouts["L2"].Override.CellAppearance.ForeColor = Color.DarkBlue;

	// Copy the "L1" layout to the layout of the ultraGrid1 and "L2" layout to the layout 
	// of ultraGrid2's.
	this.ultraGrid1.DisplayLayout.CopyFrom( this.ultraGrid1.Layouts["L1"] );
	this.ultraGrid2.DisplayLayout.CopyFrom( this.ultraGrid1.Layouts["L2"] );

}

See Also