Imports DevExpress.XtraGrid
Imports DevExpress.XtraGrid.Views.Grid
Public Class GridControlDefaults
Public Shared Sub DefaultGridSettings(grid As GridControl, Container As Control)
For Each oView In grid.Views
If TypeOf oView Is GridView Then
DefaultGridViewSettings(oView)
End If
Next
End Sub
Public Shared Sub ReadOnlyGridSettings(grid As GridControl, Container As Control)
For Each oView In grid.Views
If TypeOf oView Is GridView Then
ReadonlyGridViewSettings(oView, Container)
End If
Next
End Sub
Public Shared Sub CheckboxSelectGridSettings(grid As GridControl, Container As Control)
For Each oView In grid.Views
If TypeOf oView Is GridView Then
CheckboxSelectGridViewSettings(oView)
End If
Next
End Sub
'''
''' Set a view to readonly
'''
Private Shared Sub ReadonlyGridViewSettings(ByRef View As GridView, Container As Control)
View.OptionsBehavior.Editable = False
View.OptionsBehavior.ReadOnly = True
End Sub
'''
''' Set view Multiselect with checkboxes
'''
Private Shared Sub CheckboxSelectGridViewSettings(ByRef View As GridView)
View.OptionsSelection.MultiSelectMode = GridMultiSelectMode.CheckBoxRowSelect
View.OptionsSelection.MultiSelect = True
End Sub
'''
''' Set default settings for view
'''
Private Shared Sub DefaultGridViewSettings(ByRef View As GridView)
View.OptionsView.ShowAutoFilterRow = True
' Color Settings
View.OptionsView.EnableAppearanceEvenRow = True
View.Appearance.EvenRow.BackColor = Color.Aquamarine
View.Appearance.FilterPanel.BackColor = Color.Orange
AddHandler View.RowStyle, AddressOf GridView_RowStyle
'AddHandler View.Layout, AddressOf GridView_Layout
End Sub
Private Shared Sub GridView_Layout(sender As Object, e As EventArgs)
'Throw New NotImplementedException()
End Sub
Private Shared Sub GridView_RowStyle(sender As Object, e As RowStyleEventArgs)
If e.RowHandle = GridControl.AutoFilterRowHandle Then
e.Appearance.BackColor = Color.LightSalmon
End If
End Sub
End Class