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
' Setting the AllowAddNew to TemplateOnBottom, TemplateOnTop or TemplateOnTopWithTabRepeat
' turns on the add-row functionality.
Me.UltraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnBottom
' You can use the TemplateAddRowAppearance to set the appearance of template add-rows.
Me.UltraGrid1.DisplayLayout.Override.TemplateAddRowAppearance.BackColor = Color.Blue
Me.UltraGrid1.DisplayLayout.Override.TemplateAddRowAppearance.ForeColor = Color.Yellow
' You can also use the TemplateAddCellRowAppearance to set the appearance of cells in
' the template add-rows.
Me.UltraGrid1.DisplayLayout.Override.TemplateAddRowCellAppearance.BackColor = Color.Blue
Me.UltraGrid1.DisplayLayout.Override.TemplateAddRowCellAppearance.ForeColor = Color.Yellow
' You can use the AddRowAppearance to set the appearance of add-row. A template add-row
' becomes an add-row when the user enters the edit mode and types something in a template
' add-row.
Me.UltraGrid1.DisplayLayout.Override.AddRowAppearance.BackColor = Color.DarkRed
Me.UltraGrid1.DisplayLayout.Override.AddRowAppearance.ForeColor = Color.Orange
' You can use the AddRowCellAppearance to set the appearance of cells in the add-rows.
Me.UltraGrid1.DisplayLayout.Override.AddRowCellAppearance.BackColor = Color.DarkRed
Me.UltraGrid1.DisplayLayout.Override.AddRowCellAppearance.ForeColor = Color.Orange
' You can also control the spacing before and after the template add-rows.
Me.UltraGrid1.DisplayLayout.Override.TemplateAddRowSpacingBefore = 5
Me.UltraGrid1.DisplayLayout.Override.TemplateAddRowSpacingAfter = 5
' You can also specify a different border style for template add-rows to distinguish
' them from the regular rows.
Me.UltraGrid1.DisplayLayout.Override.BorderStyleTemplateAddRow = UIElementBorderStyle.Raised
' Use the DefaultCellValue property of the column to specify the default values that
' should be assigned to the add-row.
Me.UltraGrid1.DisplayLayout.Bands(0).Columns(0).DefaultCellValue = "(Empty)"
' You can display a prompt in the add-row by setting the TemplateAddRowPrompt
' proeprty. By default UltraGrid does not display any add-row prompt.
e.Layout.Override.TemplateAddRowPrompt = "Click here to add a new record..."
' You can control the appearance of the prompt using the Override's
' TemplateAddRowPromptAppearance property. By default the prompt is
' transparent. You can make it non-transparent by setting the appearance'
' BackColorAlpha property or by setting the BackColor to a desired value.
e.Layout.Override.TemplateAddRowPromptAppearance.ForeColor = Color.Maroon
e.Layout.Override.TemplateAddRowPromptAppearance.FontData.Bold = DefaultableBoolean.True
' By default the prompt is displayed across multiple cells. You can confine
' the prompt a particular cell by setting the SpecialRowPromptField property
' of the band to the key of the column that you want to display the prompt in.
e.Layout.Bands(0).SpecialRowPromptField = e.Layout.Bands(0).Columns(1).Key
End Sub