Infragistics(R) NetAdvantage(R) Windows Forms
Load(String,PropertyCategories) Method
See Also  Example E-mail your feedback on this topic.
Infragistics.Win.UltraWinGrid Namespace > UltraGridLayout Class > Load Method : Load(String,PropertyCategories) Method

filename
The name of the file to read.
propertyCategories
Identifies which property categories to load.
Loads a layout from a file, using the specified property categories.

Syntax

Visual Basic (Declaration) 
Public Overloads Sub Load( _
   ByVal filename As String, _
   ByVal propertyCategories As PropertyCategories _
) 
C# 
public void Load( 
   string filename,
   PropertyCategories propertyCategories
)

Parameters

filename
The name of the file to read.
propertyCategories
Identifies which property categories to load.

Example

Following code shows you how to save and load the saved layout using overloads of Save and Load methods that take in a file name.

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

    Private Sub UltraGrid1_InitializeLayout(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs) Handles UltraGrid1.InitializeLayout
        ' Setup the layout.
        e.Layout.Override.CellAppearance.BackColor = Color.LightYellow
        e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy
    End Sub

    Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
        ' Save the layout to a file.
        Me.UltraGrid1.DisplayLayout.Save("c:\\test.lyt")
    End Sub

    Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button2.Click
        ' Reset the layout.
        Me.UltraGrid1.DisplayLayout.Reset()
    End Sub

    Private Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button3.Click
        ' Load the saved layout.
        Me.UltraGrid1.DisplayLayout.Load("c:\\test.lyt")
    End Sub
C#Copy Code
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

		private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
		{
			// Setup the layout.
			e.Layout.Override.CellAppearance.BackColor = Color.LightYellow;
			e.Layout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			// Save the layout to a file.
			this.ultraGrid1.DisplayLayout.Save( "c:\\test.lyt" );
		}

		private void button2_Click(object sender, System.EventArgs e)
		{
			// Reset the layout.
			this.ultraGrid1.DisplayLayout.Reset( );
		}

		private void button3_Click(object sender, System.EventArgs e)
		{
			// Load the saved layout.
			this.ultraGrid1.DisplayLayout.Load( "c:\\test.lyt" );
		}

Remarks

Invoking this method loads a layout, created by invoking the Save(String) method, from a file.

When specifying 256 (PropCatGeneral), the following property settings for the UltraGridLayout object are loaded:

  • AddNewBox
  • AlphaBlendEnabled
  • BorderStyle
  • BorderStyleCaption
  • Caption
  • Enabled
  • EstimatedRows
  • Font
  • InterBandSpacing
  • MaxColScrollRegions
  • MaxRowScrollRegions
  • Override
  • RowConnectorColor
  • RowConnectorStyle
  • ScrollBars
  • TabNavigation
  • TagVariant
  • ViewStyle
  • ViewStyleBand

Multiple Layout categories can be copied by combining them using logical Or.

The Clone and CopyFrom methods can be invoked to make a duplicate of a layout.

See Also