| Visual Basic (Declaration) | |
|---|---|
Public Class UltraGridOverride Inherits Infragistics.Shared.KeyedSubObjectBase Implements Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.ISupportPresets | |
| C# | |
|---|---|
public class UltraGridOverride : Infragistics.Shared.KeyedSubObjectBase, Infragistics.Shared.IKeyedSubObject, Infragistics.Shared.IKeyedSubObjectEx, Infragistics.Win.ISupportPresets | |
| Visual Basic | Copy Code |
|---|---|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim o As Infragistics.Win.UltraWinGrid.UltraGridOverride ' Get the Override from the layout or a specific band (in this case band 2) If CheckBox1.Checked Then o = Me.UltraGrid1.DisplayLayout.Override Else o = Me.UltraGrid1.DisplayLayout.Bands(2).Override End If o.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TabRepeat o.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.WithinBand o.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Synchronized o.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.WithinGroup o.AllowDelete = Infragistics.Win.DefaultableBoolean.False o.AllowGroupBy = Infragistics.Win.DefaultableBoolean.True o.AllowGroupMoving = Infragistics.Win.UltraWinGrid.AllowGroupMoving.NotAllowed o.AllowGroupSwapping = Infragistics.Win.UltraWinGrid.AllowGroupSwapping.NotAllowed o.AllowUpdate = Infragistics.Win.DefaultableBoolean.True o.BorderStyleCardArea = Infragistics.Win.UIElementBorderStyle.InsetSoft o.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Solid o.BorderStyleHeader = Infragistics.Win.UIElementBorderStyle.Default o.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Solid o.CardSpacing = 2 o.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect o.CellMultiLine = Infragistics.Win.DefaultableBoolean.False o.CellPadding = 2 o.CellSpacing = 3 o.DefaultColWidth = 120 o.DefaultRowHeight = 20 o.ExpansionIndicator = Infragistics.Win.UltraWinGrid.ShowExpansionIndicator.CheckOnExpand o.GroupByColumnsHidden = Infragistics.Win.DefaultableBoolean.True o.GroupByRowPadding = 2 o.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti o.MaxSelectedCells = 1000 o.MaxSelectedRows = 100 o.NullText = "{null}" o.RowSelectors = Infragistics.Win.DefaultableBoolean.True o.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.Free o.RowSizingArea = Infragistics.Win.UltraWinGrid.RowSizingArea.EntireRow o.RowSizingAutoMaxLines = 3 o.RowSpacingAfter = 4 o.RowSpacingBefore = 5 o.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.Extended o.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag o.SelectTypeGroupByRow = Infragistics.Win.UltraWinGrid.SelectType.Single o.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended o.TipStyleCell = Infragistics.Win.UltraWinGrid.TipStyle.Show o.TipStyleRowConnector = Infragistics.Win.UltraWinGrid.TipStyle.Hide o.TipStyleScroll = Infragistics.Win.UltraWinGrid.TipStyle.Default o.ActiveCardCaptionAppearance.BackColor = Color.AliceBlue o.ActiveCellAppearance.ForeColor = Color.Red o.ActiveRowAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True o.CardAreaAppearance.BackColor = Color.BlueViolet o.CardAreaAppearance.BackColor2 = Color.BlanchedAlmond o.CardAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump o.CardCaptionAppearance.FontData.SizeInPoints = 20.0 o.CellAppearance.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter End Sub | |
| C# | Copy Code |
|---|---|
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button1.Click
{
Infragistics.Win.UltraWinGrid.UltraGridOverride o As Infragistics.Win.UltraWinGrid.UltraGridOverride
// Get the Override from the layout or a specific band (in this case band 2)
if (CheckBox1.Checked)
o = Me.UltraGrid1.DisplayLayout.Override;
else
o = Me.UltraGrid1.DisplayLayout.Bands(2).Override;
o.AllowAddNew = Infragistics.Win.UltraWinGrid.AllowAddNew.TabRepeat;
o.AllowColMoving = Infragistics.Win.UltraWinGrid.AllowColMoving.WithinBand;
o.AllowColSizing = Infragistics.Win.UltraWinGrid.AllowColSizing.Synchronized;
o.AllowColSwapping = Infragistics.Win.UltraWinGrid.AllowColSwapping.WithinGroup;
o.AllowDelete = Infragistics.Win.DefaultableBoolean.False;
o.AllowGroupBy = Infragistics.Win.DefaultableBoolean.True;
o.AllowGroupMoving = Infragistics.Win.UltraWinGrid.AllowGroupMoving.NotAllowed;
o.AllowGroupSwapping = Infragistics.Win.UltraWinGrid.AllowGroupSwapping.NotAllowed;
o.AllowUpdate = Infragistics.Win.DefaultableBoolean.True;
o.BorderStyleCardArea = Infragistics.Win.UIElementBorderStyle.InsetSoft;
o.BorderStyleCell = Infragistics.Win.UIElementBorderStyle.Solid;
o.BorderStyleHeader = Infragistics.Win.UIElementBorderStyle.Default;
o.BorderStyleRow = Infragistics.Win.UIElementBorderStyle.Solid;
o.CardSpacing = 2;
o.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.CellSelect;
o.CellMultiLine = Infragistics.Win.DefaultableBoolean.False;
o.CellPadding = 2;
o.CellSpacing = 3;
o.DefaultColWidth = 120;
o.DefaultRowHeight = 20;
o.ExpansionIndicator = Infragistics.Win.UltraWinGrid.ShowExpansionIndicator.CheckOnExpand;
o.GroupByColumnsHidden = Infragistics.Win.DefaultableBoolean.True;
o.GroupByRowPadding = 2;
o.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti;
o.MaxSelectedCells = 1000;
o.MaxSelectedRows = 100;
o.NullText = "{null}";
o.RowSelectors = Infragistics.Win.DefaultableBoolean.True;
o.RowSizing = Infragistics.Win.UltraWinGrid.RowSizing.Free;
o.RowSizingArea = Infragistics.Win.UltraWinGrid.RowSizingArea.EntireRow;
o.RowSizingAutoMaxLines = 3;
o.RowSpacingAfter = 4;
o.RowSpacingBefore = 5;
o.SelectTypeCell = Infragistics.Win.UltraWinGrid.SelectType.Extended;
o.SelectTypeCol = Infragistics.Win.UltraWinGrid.SelectType.ExtendedAutoDrag;
o.SelectTypeGroupByRow = Infragistics.Win.UltraWinGrid.SelectType.Single;
o.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Extended;
o.TipStyleCell = Infragistics.Win.UltraWinGrid.TipStyle.Show;
o.TipStyleRowConnector = Infragistics.Win.UltraWinGrid.TipStyle.Hide;
o.TipStyleScroll = Infragistics.Win.UltraWinGrid.TipStyle.Default;
o.ActiveCardCaptionAppearance.BackColor = Color.AliceBlue;
o.ActiveCellAppearance.ForeColor = Color.Red;
o.ActiveRowAppearance.FontData.Bold = Infragistics.Win.DefaultableBoolean.True;
o.CardAreaAppearance.BackColor = Color.BlueViolet;
o.CardAreaAppearance.BackColor2 = Color.BlanchedAlmond;
o.CardAreaAppearance.BackGradientStyle = Infragistics.Win.GradientStyle.VerticalBump;
o.CardCaptionAppearance.FontData.SizeInPoints = 20.0;
o.CellAppearance.TextTrimming = Infragistics.Win.TextTrimming.EllipsisCharacter;
} | |
The Override object has properties which define the look and behavior of Bands in the grid.
The Override property exists both on the UltraGridBase.DisplayLayout and on the UltraGridBand object. This allows you to set properties that apply to all bands, and then override those property settings on each individual band. Some properties on the override also exist on the column and can be overriden on a finer level. For example:
In VB:
Me.UltraGrid1.DisplayLayout.Override.CellAppearance.BackColor = Color.Blue
Me.UltraGrid1.DisplayLayout.Bands(1).Override.CellAppearance.BackColor = Color.White
Me.UltraGrid1.DisplayLayout.Bands(1).Columns(0).CellAppearance.BackColor = Color.Red
In C#:
this.ultraGrid1.DisplayLayout.Override.CellAppearance.BackColor = Color.Blue;
this.ultraGrid1.DisplayLayout.Bands[1].Override.CellAppearance.BackColor = Color.White;
this.ultraGrid1.DisplayLayout.Bands[1].Columns[0].CellAppearance.BackColor = Color.Red;
In this case, the first line of code will affect all cells in the grid and set their BackColor to Blue. The second line set the BackColor of all cells in Band 1 to White. The third line sets all the cells of Column 0 in Band 1 to Red. In general, the smaller object will take precedence over a larger object. So since the column is the smallest (most limited) object, it's property settings take precedence over the Band Override. The band is smaller (more limited) that the DisplayLayout. So the Band Override settings take precedence over the DisplayLayout Override settings.