Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private toggleFlag As Boolean = False
Private layout1 As UltraGridLayout = Nothing
Private layout2 As UltraGridLayout = Nothing
Private Sub Button9_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button9.Click
If Me.layout1 Is Nothing Or Me.layout2 Is Nothing Then
Me.layout1 = Me.ultraGrid1.DisplayLayout
' Make a clone of layout1.
Me.layout2 = layout1.Clone(PropertyCategories.All)
' Setup layout2.
layout2.Override.CellAppearance.BackColor = Color.LightSkyBlue
layout2.Bands(0).Columns(0).CellAppearance.BackColor = Color.Red
End If
' Reset the layout since CopyFrom only copies properties that are set
' on the source layout.
Me.ultraGrid1.DisplayLayout.Reset()
If toggleFlag Then
' Copy the layout from layout1
Me.ultraGrid1.DisplayLayout.CopyFrom(layout1, PropertyCategories.All)
Else
' Copy the layout from layout2
Me.ultraGrid1.DisplayLayout.CopyFrom(layout2, PropertyCategories.All)
End If
' Toggle the flag.
toggleFlag = Not toggleFlag
End Sub