Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' Create a data table with 3 columns.
Dim dt As DataTable = New DataTable("Table1")
dt.Columns.Add("Col1", GetType(String))
dt.Columns.Add("Col2", GetType(String))
dt.Columns.Add("Col3", GetType(String))
' Fill the data table with some random data.
Dim i As Integer
For i = 0 To 100 - 1
dt.Rows.Add(New String() {"Test" & i + 1, "Test" & i + 2, "Test" & i + 3})
Next
' Set the grid's data source to the data table.
Me.UltraGrid1.DataSource = dt
Dim band As UltraGridBand = Me.UltraGrid1.DisplayLayout.Bands("Table1")
band.Override.RowSpacingAfter = 5
' Turn on the row layout functionality for Table1 band.
band.RowLayoutStyle = RowLayoutStyle.ColumnLayout
' Create a new row layout with "RowLayout1" as the key.
Dim rowLayout1 As RowLayout = band.RowLayouts.Add("RowLayout1")
' Setup the columns.
rowLayout1.ColumnInfos("Col1").Initialize(0, 0, 2, 2)
rowLayout1.ColumnInfos("Col2").Initialize(2, 0, 2, 2)
rowLayout1.ColumnInfos("Col3").Initialize(0, 2, 4, 2)
' Setup other settings.
rowLayout1.CardView = False
' RowLayoutLabelStyle only applies in regular view (non-card view).
rowLayout1.RowLayoutLabelStyle = RowLayoutLabelStyle.WithCellData
rowLayout1.RowLayoutLabelPosition = LabelPosition.Left
' Create a new row layout with "RowLayout2" as the key.
Dim rowLayout2 As RowLayout = band.RowLayouts.Add("RowLayout2")
' Setup the columns.
rowLayout2.ColumnInfos("Col1").Initialize(0, 0, 2, 2)
rowLayout2.ColumnInfos("Col2").Initialize(0, 2, 2, 2)
rowLayout2.ColumnInfos("Col3").Initialize(2, 0, 2, 4)
rowLayout2.ColumnInfos("Col3").LabelPosition = LabelPosition.Top
' Setup other settings.
rowLayout2.CardView = True
' CardViewStyle only applies in card-view.
rowLayout2.CardViewStyle = CardStyle.StandardLabels
rowLayout2.RowLayoutLabelPosition = LabelPosition.Left
' Load the RowLayout2 row-layout.
band.RowLayouts("RowLayout2").Apply()
End Sub
Private Sub CheckBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles checkBox1.CheckedChanged
If Me.CheckBox1.Checked Then
Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("RowLayout1").Apply()
Else
Me.UltraGrid1.DisplayLayout.Bands(0).RowLayouts("RowLayout2").Apply()
End If
End Sub