Transfer: Infragistics netadvantage UltraGrid (UltraWinGrid) Programming Notes

sponsored links
UltraGrid is Infragistics netadvanage control library provides a Windows Grid control, powerful, can replace the VS provided the GridView control. I wonder why the introduction of its articles of domestic small. This function is very powerful stuff, but its design principle and the general control properties are not the same property is extremely complex and almost impossible without manual coding. Here I compiled some information on when the right to extend. This is used in reference to programming style of writing is random between hope forgive me. kevin cheng 2008-08-20

Reference Provider Home: http://www.infragistics.com/

Term
persist persistence (save)
property property
attribute characteristics
setting setting
Band band data

1, UltraGrid the basic concepts
UltraGrid's property design and general control is rather different. To understand its design, from its vast property to help you quickly find what you need. In the article in the WinGrid, UltraGrid, UltraWinGrid is the same thing.

WinGrid
Is a data grid control to display hierarchical data source to achieve IList or ITypedList interface, you can display (but not necessarily be additions and deletions)
Can show the hierarchical relationship of data, such as customers - orders - order details

WinGrid features:
* Sorting filter to adjust the size of the statistical profession to freeze columns and rows out to freeze the location of drag adjustment reversed Outlook style BroupBy split view feature (the user can drag the column to group the data packet column )
* Card view custom layout of rows of data cells can use a variety of editorial control Export to Excel
* Print Other Infragistics Presentation Layer Framework of public properties, such as: Apperances, DrawFilters, CreationFilters

WinGrid data and level data striping
UltraGrid can express a hierarchy of data for each level of data with a band (data striping) to describe each band has a number of the column and row, similar to the DataTable
The relationship between level associated with a foreign key to describe the

WinGrid appearance style program (1) Appearance object using the control controls the look and style settings WinGrid control the appearance of
* Does not directly set the font attributes such as background color
* But to create or select an existing Appearance object (similar to the Web's css class style)
* The Appearance object has properties related to a variety of formats, such as alignment, fonts, colors, images, and alpha fusion of information in the manner the following benefits:
* Reduced the amount of code
* Easy to control the appearance of unity, only to change the Appearance object can
* The Grid has a number of child elements that control the appearance of using this method to set the memory consumption may be effective in reducing

(2) its layout and appearance of preservation of sustainable
UltraGrid.DisplayLayout property (UltraGridLayout class) as the preservation of all the sustainable features and objects of the container to call the object's Load (), Save (), LoadFromXml (), SaveAsXml () function to access the appearance of control because most of the UltraGrid's settings can be sustained based, so most of the functions are set by UltraGridLayout object

(3) The style is inherited from the superior control and overloaded if the control set its Appearance as the Default, the control will inherit his father's control of the style settings (rather than what the default value)
If by default, cell background color using the row, while row background color using the band
Band parent object inherits the default object style, but use Override property (UltraGridOverride class) to set their special properties
WinGrid decided to draw an object's appearance and behavior
* First check the object's Override property
* If the value of the property is explicitly modified (non-Default), then use the value
* Otherwise, use the higher value of the corresponding object (Default)
Most of the attributes that can be set directly in the WinGrid can also be set in the Band, which will cover the former
/ / Example: by default only one-way choice, and orders band allows you to select multiple lines
using Infragistics.Win.UltraWinGrid;
UltraGrid1.DisplayLayout.Override.SelectTypeRow = SelectType.Single;
UltraGrid1.DisplayLayout.Bands ["Orders"]. Override.SelectTypeRow = SelectType.Extended;

Card View (Card View)
Each record with a card to show, similar to the form view, the restrictions can only display the card view of the bottom band data can not demonstrate its sub-layer data can not add new record?
Setting method
grid.Band [0]. CardView = true;
grid.Band [0]. CardSettings ..... style settings

Group view (GroupBy View)
Similar outlook 2007, can be grouped onto the column column to display operation data grouping method:
grid.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;

Second, UltraGrid designer operation

UltraWinGrid Designer (UltraGrid designer items)
Basic Settings:
Data Schema: set bound column data format
Presets: Choose a style from the default, there are three types: (1) only with the appearance-related; (2) only and behaviors; (3) both
Manage Presets: Preset Management and settings
Feature Picker: configuration. See later
Appearance Browser: customize the appearance of the style of some
Band and Column Settings: to show the data set and column set
Band [0] - 'Band 0':
Columns: display column setting: Data Schema defined in the bound column, non-binding column
Column Arrangement Overview: column placement settings (similar to the Report Designer)
Column Arrangement Designer: two types: Row layout (the header can be used for complicated settings), Group and levels
Control Settings: controls all the property. In fact, all of the above settings can be found here, just deep level is not easy to find. See below.

Feature Picker (UltraGrid feature set)
AutoFit Style: automatically adapt to the width of the column
CardView: Card View
Column Moving: it can drag the column position
Column Sizing: the way the column width adjustment
Column Swapping: whether to allow the column to exchange position
Empty Rows: whether the display blank lines, blank lines style
Filtering: Filters out
Fixed Headers: freeze out
Fixed Rows: freeze line
Header Click Sort Action: Click the column headings Sort by: Sort & multi-column form a separate
IDataErrorInfo Support: data error authentication
Merged Cell:? Merge Cells
Outlook Group By: Outlook Group style (can be customized data packet)
Row Selectors: row selection symbol (a small arrow)
Row Siziing: line to adjust the way a high degree of
Scrolling: Scroll Bar Styles
Selection: select the way the ranks of cell
Summaries: Statistical Cell
Updating: whether to allow data line CRUD

Control Setting (UltraGrid control to set specific attributes)
Appearance
Behavior
Data
Design
Layout
DiaplayLayout
AddNewBox
AutoFitStyle
Bands
EnmptyRowSettings
Override
AllowAddNew
AllowDelete
AllowUpdate
RowSizing
ViewStyle: SingleBand | MultiBand
Miscellaneous

Common operations add Column: Start \ Basic Settings \ Data Schema \ Manually Define a Schema \ Add Column, named using the database field names.
Add Column Title: Band and Column Settings \ Band [0] (after manually add Column) \ Columns \ select out \ Header \ modify the Caption property Sort: Picker / Filtring / Allow
Group: Picker / OutLook GroupBy / Active
Editor: Picker / Update
Multi-line header: Column Arrangement Designer / Add Group / Add Level / drag the group to the corresponding column below
Hide columns: Column Arrangement Designer / Show Hide
Separate not edit: Band [0] / Column / cellactivation set NoEdit
Click the cell selection status: Band [0] / Column / CellClickAction
Cell edit control: Band [0] / Column / EditorControl
Cells combined: Band [0] / Column / MergedCell. . .
Freeze out: Picker / Fixed Header

3, UltraGrid Appearance control ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Grid ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Dynamic reproduced style file
this.ultraGrid1.ApplyPresetFromXml (@ "C: \ Program Files \ Common Files \ Infragistics" +
@ "\ Presets \ Win \ UltraGridBase \ Standard \ FlatGreen.xml", true);

Access to the layout file (available this stuff design statements, dynamic loading)
this.ultraGrid1.DisplayLayout.SaveAsXml ("WinGridLayout.xml");
this.ultraGrid1.DisplayLayout.LoadFromXml (System.IO.Path.Combine (Application.StartupPath,

@ ".. \ .. \ ExtraFiles \ WinGridLayout.xml"));

Use Appearance (similar to the pre-defined style)
this.ultraGrid1.DisplayLayout.Appearances.Add ("Highlighted");
this.ultraGrid1.DisplayLayout.Appearances ["Highlighted"]. BackColor = Color.Red;
this.ultraGrid1.DisplayLayout.Appearances ["Highlighted"]. BackColor = Color.White;
Or directly to the default assignment Appearance
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.White;

Using the operating system style
this.ultraGrid1.UseOsThemes = DefaultableBoolean.True;

HotTrack
this.ultraGrid1.DisplayLayout.Override.HotTrackCellAppearance.BackColor = Color.Blue;
this.ultraGrid1.DisplayLayout.Override.HotTrackRowCellAppearance.BackColor =

Color.Yellow;
this.ultraGrid1.DisplayLayout.Override.HotTrackHeaderAppearance.BackColor =

Color.Blue;
this.ultraGrid1.DisplayLayout.Override.HotTrackRowAppearance.ForeColor =

Color.LightGreen;
this.ultraGrid1.DisplayLayout.Override.HotTrackRowSelectorAppearance.BackColor =

Color.Green;

Split split view scrolling view settings (creating SplitBar)
this.ultraGrid1.DisplayLayout.ColScrollRegions [0]. Split (0);
this.ultraGrid1.DisplayLayout.RowScrollRegions [0]. Split (200);
Cancel split view
this.ultraGrid1.DisplayLayout.MaxColScrollRegions = 1;
this.ultraGrid1.DisplayLayout.MaxRowScrollRegions = 1;

Modify the Tab key functionality
this.ultraGrid1.DisplayLayout.TabNavigation = TabNavigation.NextControl;

TabletPC Ink-Enable
Will UltraInkProvider component onto the form you can edit the state of the input box on the right will display a small button, when clicked, will pop up handwriting input box to the non-TabletPC on the use of the function, need to install the TabletPC SDK

Definition and application of exterior style
this.ultraGrid1.DisplayLayout.Appearances.Add ("Highlighted");
this.ultraGrid1.DisplayLayout.Appearances ["Highlighted"]. BackColor = Color.Red;
this.ultraGrid1.DisplayLayout.Appearances ["Highlighted"]. BackColor = Color.White;
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance =

this.ultraGrid1.DisplayLayout.Appearances ["Highlighted"];
this.ultraGrid1.DisplayLayout.Override.RowSelectorAppearance =

this.ultraGrid1.DisplayLayout.Appearances ["Highlighted"];
--------------------------
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.Red;
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.ForeColor = Color.White;
this.ultraGrid1.DisplayLayout.Override.RowSelectorAppearance.BackColor = Color.Red;
this.ultraGrid1.DisplayLayout.Override.RowSelectorAppearance.ForeColor = Color.White;

GroupBy view
this.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
this.ultraGrid1.DisplayLayout.Bands [0]. SortedColumns.Add ("Country", false, true);
this.ultraGrid1.DisplayLayout.Bands [0]. SortedColumns.Add ("City", false, true);
-------------------------------------------------- -----
this.ultraGrid1.DisplayLayout.ViewStyleBand = ViewStyleBand.OutlookGroupBy;
this.ultraGrid1.DisplayLayout.GroupByBox.Style = GroupByBoxStyle.Compact;
this.ultraGrid1.DisplayLayout.GroupByBox.Appearance.BackColor = Color.White;
this.ultraGrid1.DisplayLayout.GroupByBox.Prompt = "Drag and drop a column to group by

that column. ";
this.ultraGrid1.DisplayLayout.GroupByBox.PromptAppearance.ForeColor = Color.Maroon;
this.ultraGrid1.DisplayLayout.GroupByBox.BorderStyle = UIElementBorderStyle.InsetSoft;
this.ultraGrid1.DisplayLayout.GroupByBox.ButtonBorderStyle =

UIElementBorderStyle.RaisedSoft;
this.ultraGrid1.DisplayLayout.GroupByBox.ShowBandLabels = ShowBandLabels.All;
this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelBorderStyle =

UIElementBorderStyle.Solid;
this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance.BackColor = Color.DarkBlue;
this.ultraGrid1.DisplayLayout.GroupByBox.BandLabelAppearance.ForeColor =

Color.LightYellow;
this.ultraGrid1.DisplayLayout.GroupByBox.ButtonConnectorStyle =

UIElementBorderStyle.Dotted;
this.ultraGrid1.DisplayLayout.GroupByBox.ButtonConnectorColor = Color.Maroon;

Card View
grid.Band [0]. CardView = true;
grid.Band [0]. CardSettings ..... style settings

Expand all rows (a row)
this.ultraGrid1.Rows.ExpandAll (true);

Data filter example
e.Layout.Override.AllowRowFiltering = DefaultableBoolean.True;
e.Layout.Override.RowFilterAction = RowFilterAction.AppearancesOnly;
e.Layout.Override.FilteredInCellAppearance.ForeColor = Color.DarkGreen;
e.Layout.Override.FilteredOutCellAppearance.ForeColor = Color.DarkRed;
Open the filter
this.ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.True;
Setting the filter function
this.ultraGrid1.DisplayLayout.Override.RowFilterMode = RowFilterMode.AllRowsInBand;
this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.FilterRow;
this.ultraGrid1.DisplayLayout.Override.FilterEvaluationTrigger =

FilterEvaluationTrigger.OnLeaveCell;
this.ultraGrid1.DisplayLayout.Override.FilterOperatorDefaultValue =

FilterOperatorDefaultValue.DoesNotContain;
this.ultraGrid1.DisplayLayout.Override.FilterOperandStyle =

FilterOperandStyle.DropDownList;
this.ultraGrid1.DisplayLayout.Override.FilterOperatorLocation =

FilterOperatorLocation.WithOperand;
this.ultraGrid1.DisplayLayout.Override.FilterOperatorDropDownItems =

FilterOperatorDropDownItems.All;
this.ultraGrid1.DisplayLayout.Override.FilterClearButtonLocation =

FilterClearButtonLocation.Row;
this.ultraGrid1.DisplayLayout.Override.FilterRowPrompt = "Click here to filter

rows ...";
this.ultraGrid1.DisplayLayout.Bands [0]. SpecialRowPromptField = "Address";
the LogicalOperator property of the ColumnFiltersCollection object.
Exterior
ultraGrid1.DisplayLayout.Override.FilterRowAppearance
ultraGrid1.DisplayLayout.Override.FilterRowAppearanceActive
ultraGrid1.DisplayLayout.Override.FilterCellAppearance
ultraGrid1.DisplayLayout.Override.FilterRowSelectorAppearance
Custom filter rules
UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands [2];
band.ColumnFilters ["Unit Price"]. FilterConditions.Clear ();
band.ColumnFilters ["Unit Price"]. FilterConditions.Add (

FilterComparisionOperator.GreaterThan, 5);
band.ColumnFilters ["Unit Price"]. FilterConditions.Add (

FilterComparisionOperator.LessThan, 10);
band.ColumnFilters ["Unit Price"]. LogicalOperator = FilterLogicalOperator.And;

Data error
this.ultraGrid1.DisplayLayout.Override.SupportDataErrorInfo =

SupportDataErrorInfo.RowsAndCells;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. SupportDataErrorInfo =

DefaultableBoolean.False;
this.ultraGrid1.DisplayLayout.Override.DataErrorCellAppearance.BackColor = Color.Red;
this.ultraGrid1.DisplayLayout.Override.DataErrorRowSelectorAppearance.BackColor =

Color.Red;
this.ultraGrid1.DisplayLayout.Override.DataErrorRowAppearance.BackColor =

Color.LightYellow;
private void ultraGrid1_InitializeRow (object sender, InitializeRowEventArgs e)
(
string rowError = "";
string cellError = "";
Object value = e.Row.Cells ["Fax"]. Value;
/ / Set the data error if Fax column value is empty
if (DBNull.Value == value)
(
rowError = "Row contains errors.";
cellError = "Fax can not be empty";
)

DataRowView drv = (DataRowView) e.Row.ListObject;
drv.Row.RowError = rowError;
drv.Row.SetColumnError ("Fax", cellError);
)

Tooltip
SummarySettings averageSummary =
e.Layout.Bands [0]. Summaries.Add (
"GradeAverage",
SummaryType.Average,
e.Layout.Bands [0]. Columns ["Grade"]);
averageSummary.SummaryPosition = SummaryPosition.UseSummaryPositionColumn;
averageSummary.SummaryPositionColumn = averageSummary.SourceColumn;
averageSummary.DisplayFormat = "Average: (0 :.##}";
averageSummary.Band.Override.SummaryFooterCaptionVisible = DefaultableBoolean.False;
averageSummary.Band.Override.BorderStyleSummaryFooter = UIElementBorderStyle.None;
----------------------------------------
SummarySettings summary =
this.ultraGrid1.DisplayLayout.Bands [0]. Summaries.Add (
"Sum",
SummaryType.Sum,
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0],
SummaryPosition.UseSummaryPositionColumn);
summary.ToolTipText = string.Format ("Sum of column (0).",

summary.SourceColumn.Header.Caption);
this.ultraGrid1.Rows.SummaryValues ["sum"]. ToolTipText = string.Format ("Sum of

column (0). ", summary.SourceColumn.Header.Caption);

AlphaBend
if (this.chkRowAlpha.Checked == true)
(
this.ultraGrid1.DisplayLayout.Override.RowAppearance.BackColorAlpha =

Alpha.UseAlphaLevel;
this.ultraGrid1.DisplayLayout.Override.RowAppearance.AlphaLevel =

short.Parse (this.spnAlphaLevel.Value.ToString ());
)
else
(
this.ultraGrid1.DisplayLayout.Override.RowAppearance.BackColorAlpha =

Alpha.Opaque;
this.ultraGrid1.DisplayLayout.Override.RowAppearance.AlphaLevel = 0;
)
------------------------------------------
if (chEnableAlphaBlending.Checked)
(
this.ultraGrid1.DisplayLayout.Appearance.ImageBackground =

Image.FromFile (clsSamplesPath.GraphicsPath + "\ \ Backgrounds \ \ nasa_saturn_montage.jpg");
this.ultraGrid1.DisplayLayout.Appearance.ImageBackgroundOrigin =

Infragistics.Win.ImageBackgroundOrigin.Form;
this.ultraGrid1.DisplayLayout.Appearance.ImageBackgroundStyle =

Infragistics.Win.ImageBackgroundStyle.Tiled;

this.ultraGrid1.AlphaBlendMode = Infragistics.Win.AlphaBlendMode.Optimized;

)
else
(
this.ultraGrid1.AlphaBlendMode = Infragistics.Win.AlphaBlendMode.Disabled;
this.ultraGrid1.DisplayLayout.Appearance.ImageBackground = null;
)

Implicit was the title
if (chShowCaption.Checked == true)
this.ultraGrid1.Text = "UltraWinGrid CardView Sample";
else
this.ultraGrid1.Text = "";

Border display
ug.DisplayLayout.BorderStyle = Infragistics.Win.UIElementBorderStyle.Solid;

Background color
ug.DisplayLayout.Appearance.BackColor = Color.White;

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Band ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Set the data band width backspace
this.ultraGrid1.DisplayLayout.Bands [1]. Indentation = 100;

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Caption ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Form Title (Caption)
this.ultraGrid1.DisplayLayout.CaptionVisible = DefaultableBoolean.True;

Title
ug.DisplayLayout.CaptionAppearance.TextHAlign = Infragistics.Win.HAlign.Left;
ug.DisplayLayout.CaptionAppearance.BackColor = Color.LightSteelBlue;

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Head ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Control the location of the header row
/ / RepeatOnBreak, FixedOnTop, OncePerRowIsland, OncePerGroupedRowIsland
e.Layout.Override.HeaderPlacement = HeaderPlacement.OncePerGroupedRowIsland;
e.Layout.Bands [0]. Override.HeaderPlacement = HeaderPlacement.FixedOnTop;

Title display wrap
this.ultraGrid1.DisplayLayout.Override.WrapHeaderText = true;

Header top fixed set displaylayout in stationarymargins

Header row style
this.ultraGrid1.DisplayLayout.Override.AllowColSizing = AllowColSizing.Free;
this.ultraGrid1.DisplayLayout.Bands [0]. HeaderVisible = true;
this.ultraGrid1.DisplayLayout.Bands [1]. HeaderVisible = true;
this.ultraGrid1.DisplayLayout.Bands [1]. Header.Caption = "Orders";
this.ultraGrid1.DisplayLayout.Bands [0]. Indentation = 0;
this.ultraGrid1.DisplayLayout.Bands [1]. Indentation = 0;
this.ultraGrid1.DisplayLayout.RowConnectorStyle = RowConnectorStyle.None;
this.ultraGrid1.DisplayLayout.Bands [0]. Header.Appearance.ThemedElementAlpha =

Alpha.Transparent;
this.ultraGrid1.DisplayLayout.Bands [0]. Header.Appearance.BackColor =

SystemColors.ActiveCaption;
this.ultraGrid1.DisplayLayout.Bands [0]. Header.Appearance.ForeColor =

SystemColors.ActiveCaptionText;
this.ultraGrid1.DisplayLayout.Bands [1]. Header.Appearance.ThemedElementAlpha =

Alpha.Transparent;
this.ultraGrid1.DisplayLayout.Bands [1]. Header.Appearance.BackColor = Color.Blue;
this.ultraGrid1.DisplayLayout.Bands [1]. Header.Appearance.BackColor2 = Color.Red;
this.ultraGrid1.DisplayLayout.Bands [1]. Header.Appearance.ForeColor = Color.White;
this.ultraGrid1.DisplayLayout.Bands [1]. Header.Appearance.BackGradientStyle =

GradientStyle.Horizontal;

Hide the header row
this.UltraGrid1.Text = "";

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Row ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Row selection mode
e.Layout.Override.SelectTypeRow = SelectType.Single;
e.DisplayLayout.Bands ["Orders"]. Override.SelectTypeRow = SelectType.Extended;
e.Layout.Override.CellClickAction = CellClickAction.RowSelect;

Select line style
ug.DisplayLayout.Override.SelectedRowAppearance.BackColor = Color.SteelBlue;

Staggered line style
this.ultraGrid1.DisplayLayout.Override.RowAlternateAppearance.BackColor = Color.Red;

Active line style
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.Red;
ug.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.SteelBlue;

Add row operation prompt
private void ultraGrid1_InitializeLayout (object sender, InitializeLayoutEventArgs e)
(
this.ultraGrid1.DisplayLayout.Bands [0]. AutoPreviewEnabled = true;
)
private void ultraGrid1_InitializeRow (object sender, InitializeRowEventArgs e)
(
e.Row.Description = "Row Description";
)
private void ultraGrid1_AfterRowInsert (object sender, RowEventArgs e)
(
this.ultraGrid1.DisplayLayout.ActiveRow.Description =
"Data changed in this row will not be added to the database" +
"Until you press the Update button.";
)

Line gradient background
UltraGridRow objRow = this.ultraGrid1.Rows [10];
this.ultraGrid1.ActiveRow = objRow;
this.ultraGrid1.Rows [10]. Appearance.BackColor2 = Color.Blue;
this.ultraGrid1.Rows [10]. Appearance.BackGradientStyle = GradientStyle.Circular;

Modify the location of new line of special lines
this.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnTop;
this.ultraGrid1.DisplayLayout.Override.SequenceFixedAddRow = 2;
Filter Bank
this.ultraGrid1.DisplayLayout.Override.AllowRowFiltering = DefaultableBoolean.True;
this.ultraGrid1.DisplayLayout.Override.FilterUIType = FilterUIType.FilterRow;
this.ultraGrid1.DisplayLayout.Override.SequenceFilterRow = 1;
Statistics line
this.ultraGrid1.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.True;
this.ultraGrid1.DisplayLayout.Override.SummaryDisplayArea = SummaryDisplayAreas.Top;
this.ultraGrid1.DisplayLayout.Override.SequenceSummaryRow = 3;

Line height adjustment
e.Layout.Override.DefaultRowHeight = 60;
e.Layout.Override.RowSizing = RowSizing.Free;
this.ultraGrid1.DisplayLayout.Override.RowSizing = RowSizing.Free;

Line layout (group show will be listed)
ultraGrid1.DisplayLayout.Bands [0]. Groups.Add ("Name");
ultraGrid1.DisplayLayout.Bands [0]. Groups.Add ("Address");
ultraGrid1.DisplayLayout.Bands [0]. Groups.Add ("Phone");
ultraGrid1.DisplayLayout.Bands [0]. Columns ["CompanyName"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Name"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["ContactName"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Name"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["ContactTitle"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Name"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["CustomerID"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Name"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Address"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Address"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Country"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Address"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["City"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Address"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Region"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Address"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["PostalCode"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Address"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Phone"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Phone"];
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Fax"]. Group =

ultraGrid1.DisplayLayout.Bands [0]. Groups ["Phone"];
ultraGrid1.DisplayLayout.Bands [0]. LevelCount = 2;
ultraGrid1.DisplayLayout.Bands [0]. Columns ["City"]. Level = 1;
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Country"]. Level = 1;
ultraGrid1.DisplayLayout.Bands [0]. Columns ["PostalCode"]. Level = 1;
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Fax"]. Level = 1;

Freeze line
this.ultraGrid1.DisplayLayout.Override.FixedRowStyle = FixedRowStyle.Top;
this.ultraGrid1.Rows.FixedRows.Add (this.ultraGrid1.Rows [0]);
this.ultraGrid1.Rows [0]. Fixed = true;
this.ultraGrid1.DisplayLayout.Override.FixedRowIndicator = FixedRowIndicator.Button;
FixedRowAppearance
FixedRowCellAppearance
FixedRowSelectorAppearance

Statistics line
this.ultraGrid1.DisplayLayout.Override.AllowRowSummaries = AllowRowSummaries.True;
this.ultraGrid1.DisplayLayout.Override.SummaryDisplayArea =

SummaryDisplayAreas.GroupByRowsFooter | SummaryDisplayAreas.TopFixed;
-------------------------------------------------- ----
this.ultraGrid1.DisplayLayout.Bands [0]. Summaries.Add (
SummaryType.Minimum,
null,
this.ultraGrid1.DisplayLayout.Bands [0]. Columns ["Country"],
SummaryPosition.Left,
null
);
this.ultraGrid1.DisplayLayout.Bands [0]. Summaries [0]. SummaryPosition =

SummaryPosition.Center;
this.ultraGrid1.DisplayLayout.Bands [0]. SummaryFooterCaption = "My Sums";

The first line shows the line number (row selector)
e.Layout.Override.RowSelectors = DefaultableBoolean.True;
e.Layout.Override.RowSelectorNumberStyle = RowSelectorNumberStyle.VisibleIndex;
e.Layout.Override.RowSelectorWidth = 30;

Select OK
this.ultraGrid1.Rows [i]. Selected = true;

Active line
this.ultraGrid1.Rows [i]. Activate ();
this.ultraGrid1.ActiveRow = this.ultraGrid1.Rows [5];
this.ultraGrid1.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.Aqua;
this.ultraGrid1.ActiveCell = this.ultraGrid1.ActiveRow.Cells ["CompanyName"];

Traverse line
/ / Navigate to first row
UltraGridRow aRow = this.ultraGrid1.GetRow (ChildRow.First);
/ / Subsequent line search
if (aRow.HasNextSibling ())
(
UltraGridRow NextRow = aRow.GetSibling (SiblingRow.Next);
MessageBox.Show ("Has Siblings");
)
/ / Search sub-line
if (aRow.HasChild ())
(
UltraGridRow childRow = aRow.GetChild (Infragistics.Win.UltraWinGrid.ChildRow.First);
MessageBox.Show ("Has a Child");
)

Determine the number of head office
this.ultraGrid1.Rows.Count

Appearance settings specific line
this.ultraGrid1.DisplayLayout.Override.SpecialRowSeparator =

SpecialRowSeparator.FixedRows;
this.ultraGrid1.DisplayLayout.Override.SpecialRowSeparatorHeight = 25;
this.ultraGrid1.DisplayLayout.Override.BorderStyleSpecialRowSeparator =

UIElementBorderStyle.Dashed;

Hidden line separator
e.Layout.Reset ();
e.Layout.Override.CellAppearance.BorderAlpha = Alpha.Transparent;
e.Layout.Override.RowAppearance.BorderColor = Color.White;

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Column ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
UltraGrid column editor type of built-in support
Default default type
Edit text box
EditButton button text box
CheckBox checkbox
TriStateCheckBox three-state check box
DropDown combo box (editable)
DropDownList drop-down box (only choice)
DropDownValidate combo box (only enter the list of data)
Button button. Click event when the trigger ClickCellButton
DropDownCalendar drop-down calendar control
Date date input, drop-down calendar control portfolio. Can be set MinValue and MaxValue, and

Input mask validation
DateWithoutDropDown date input
DateWithSpin like Date control, but with a spin button instead of the drop-down calendar control
DateTime Date Time Input Control
DateTimeWithoutDropDown date and time input controls, but abolished the drop-down button
DateTimeWithSpin date and time input controls, use the spin button to replace the drop-down button
Color Color choices
Currency rates can modify the properties of custom mask MaskInput
CurrencyNonNegative amount, does not allow negative
CurrencyPositive amount, allowing only positive
Double double. NumberFormatInfo can set the mask, with MinValue MaxValue

Limits
DoubleWithSpin double + spin
DoubleNonNegative double non-negative
DoubleNonNegativeWithSpin double non-negative spin
DoublePositive double positive
DoublePositiveWithSpin double positive spin
Font font selection box
Image Image display (EmbeddableImageRenderer)
ImageWithShadow images, shadow effects
Integer Integer
IntegerWithSpin integer, spin
IntegerPositive integer, positive number
IntegerPositiveWithSpin integer, positive number, spin
IntegerNonNegative integer, non-negative
IntegerNonNegativeWithSpin integer, non-negative, spin
Time Time (available MaskInput set mask, with Minimum and maximum range settings

)
TimeWithSpin time, spin
TimeZone Time Zone
URL URL (FormattedLinkEditor)
FormattedText formatted text (FormattedLinkEditor)

Examples of the types set out in editing
button
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. Style = ColumnStyle.Button;
checkbox
this.ultraGrid1.DisplayLayout.Bands [0]. Columns.Add ("CheckBoxColumn");
this.ultraGrid1.DisplayLayout.Bands [0]. Columns ["CheckBoxColumn"]. DataType = typeof

(Bool);
this.ultraGrid1.DisplayLayout.Bands [0]. Columns ["CheckBoxColumn"]. Style =

ColumnStyle.CheckBox;
dropdownlist
this.ultraGrid1.DisplayLayout.ValueLists.Add ("List1");
this.ultraGrid1.DisplayLayout.ValueLists ["List1"]. ValueListItems.Add (1, "One");
this.ultraGrid1.DisplayLayout.ValueLists ["List1"]. ValueListItems.Add (2, "Two");
this.ultraGrid1.DisplayLayout.ValueLists ["List1"]. ValueListItems.Add (3, "Three");
this.ultraGrid1.DisplayLayout.ValueLists ["List1"]. DisplayStyle =

ValueListDisplayStyle.DisplayText;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [2]. Style = ColumnStyle.DropDownList;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [2]. ValueList =

this.ultraGrid1.DisplayLayout.ValueLists ["List1"];

Manually edit control cells
EmbeddableEditorBase editor = null;
DefaultEditorOwnerSettings editorSettings = new DefaultEditorOwnerSettings ();
---------------------------------------
EditorWithText
editorSettings.DataType = typeof (string);
editor = new EditorWithText (new DefaultEditorOwner (editorSettings));
ColorPickerEditor
editorSettings.DataType = typeof (Color);
editor = new ColorPickerEditor (new DefaultEditorOwner (editorSettings));
FontNameEditor
valueList = new ValueList ();
editorSettings.DataType = typeof (string);
for (int i = 0; i <System.Drawing.FontFamily.Families.Length; i + +)
valueList.ValueListItems.Add (System.Drawing.FontFamily.Families [i]. Name);
editorSettings.ValueList = valueList;
editor = new FontNameEditor (new DefaultEditorOwner (editorSettings));
---------------------------------------
EditorWithMarsk (Currency)
editorSettings.DataType = typeof (decimal);
editor = new EditorWithMask (new DefaultEditorOwner (editorSettings));
editorSettings.MaskInput = "$-nn, nnn, nnn.nn";
EditorWithMask (double)
editorSettings.DataType = typeof (double);
editorSettings.MaskInput = "-nnnnnnnn.nnnn";
editor = new EditorWithMask (new DefaultEditorOwner (editorSettings));

EditorWithMask (integers)
editorSettings.DataType = typeof (int);
editor = new EditorWithMask (new DefaultEditorOwner (editorSettings));
editorSettings.MaskInput = "-nnnnnnnn";
EditorWithMask (IPv4)
editorSettings.DataType = typeof (string);
editor = new EditorWithMask (new DefaultEditorOwner (editorSettings));
editorSettings.MaskInput = "nnn \ \. nnn \ \. nnn \ \. nnn";
EditorWithMask (phone numbers)
editorSettings.DataType = typeof (string);
editor = new EditorWithMask (new DefaultEditorOwner (editorSettings));
editorSettings.MaskInput = "(###) ###-####";
EditorWithMask (hh: mms: ss tt)
editorSettings.DataType = typeof (DateTime);
editorSettings.MaskInput = "hh: mm: ss tt";
editor = new EditorWithMask (new DefaultEditorOwner (editorSettings));
---------------------------------------
EditorWithCombo (Yes No dropdownlist)
editorSettings.DataType = typeof (bool);
valueList = new ValueList ();
valueList.ValueListItems.Add (true, "Yes");
valueList.ValueListItems.Add (false, "No");
editorSettings.ValueList = valueList;
editor = new EditorWithCombo (new DefaultEditorOwner (editorSettings));
EditorWithCombo (using ValueList)
valueList = new ValueList ();
valueList.ValueListItems.Add (0, "Zero");
valueList.ValueListItems.Add (1, "One");
valueList.ValueListItems.Add (2, "Two");
valueList.ValueListItems.Add (3, "Three");
valueList.ValueListItems.Add (4, "Four");
valueList.ValueListItems.Add (5, "Five");
editorSettings.ValueList = valueList;
editorSettings.DataType = typeof (int);
editor = new EditorWithCombo (new DefaultEditorOwner (editorSettings));
EditorWithCombo (using UltraDropDown)
/ / UltraDropDown: IValueList
UltraDropDown dropDown = new UltraDropDown ();
dropDown.Visible = false;
dropDown.DataSource = new Record [] (
new Record ("Cust 1"),
new Record ("Cust 2"),
new Record ("Cust 3"),
new Record ("Cust 4")
);
dropDown.ValueMember = "ID"; / / Cell values of this column are used as data.
dropDown.DisplayMember = "Data"; / / Cell values of this column are dispalyed in the

cells.
dropDown.DisplayLayout.Override.CellAppearance.BackColor = Color.LightYellow;
dropDown.DisplayLayout.Override.CellAppearance.BackColor2 = Color.Yellow;
dropDown.DisplayLayout.Override.CellAppearance.BackGradientStyle =

GradientStyle.ForwardDiagonal;
this.Controls.Add (dropDown);
/ /
editorSettings.ValueList = dropDown;
editorSettings.DataType = typeof (int);
editor = new EditorWithCombo (new DefaultEditorOwner (editorSettings));
---------------------------------------
OptionSetEditor
editorSettings.DataType = typeof (bool);
valueList = new ValueList ();
valueList.ValueListItems.Add (true, "Yes");
valueList.ValueListItems.Add (false, "No");
editorSettings.ValueList = valueList;
editor = new OptionSetEditor (new DefaultEditorOwner (editorSettings));
---------------------------------------
CheckEditor
editorSettings.DataType = typeof (bool);
editor = new CheckEditor (new DefaultEditorOwner (editorSettings));
CheckEditor (ThreeState)
editorSettings.DataType = typeof (bool);
editor = new CheckEditor (new DefaultEditorOwner (editorSettings));
((CheckEditor) editor). ThreeState = true;
---------------------------------------
DateTimeEditor
editorSettings.DataType = typeof (DateTime);
editorSettings.MaskInput = "mm / dd / yyyy";
editor = new DateTimeEditor (new DefaultEditorOwner (editorSettings));
DateTimeEditor (mm / dd / yy hh: mm: ss)
editorSettings.DataType = typeof (DateTime);
editorSettings.MaskInput = "mm / dd / yy hh: mm: ss";
editor = new DateTimeEditor (new DefaultEditorOwner (editorSettings));
---------------------------------------
ProgressBarEditor
editorSettings.DataType = typeof (int);
editor = new Infragistics.Win.UltraWinProgressBar.ProgressBarEditor (new

DefaultEditorOwner (editorSettings));

Set FieldValue control column
private void ultraGrid2_InitializeRow (object sender,

Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e)
(
string fieldType = e.Row.Cells ["FieldType"]. Text;
EmbeddableEditorBase editor = ...
e.Row.Cells ["FieldValue"]. Editor = editor;
)

Read columns
e.Layout.Override.Rows ["xxx"]. CellActivation = CellActivation.NoEdit;

Hide Column
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. Hidden = true;

Freeze out
this.ultraGrid1.DisplayLayout.UseFixedHeaders = true;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. Header.Fixed = true;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. Header.FixedHeaderIndicator =

FixedHeaderIndicator.None;
this.ultraGrid1.DisplayLayout.Override.FixedHeaderAppearance.BackColor =

Color.LightYellow;
this.ultraGrid1.DisplayLayout.Override.FixedCellAppearance.BackColor = Color.LightYellow;
this.ultraGrid1.DisplayLayout.Override.FixedCellSeparatorColor = Color.Red;

Display column separator
this.ultraGrid1.DisplayLayout.Override.CellAppearance.BorderColor = Color.Red;

Allow drag and switch out
this.ultraGrid1.DisplayLayout.Override.AllowColMoving = AllowColMoving.WithinBand;
this.ultraGrid1.DisplayLayout.Override.AllowColSwapping = AllowColSwapping.WithinBand;

Column width adjustment
e.Layout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;
e.Layout.Override.AllowColSizing = AllowColSizing.Free;
this.ultraGrid1.DisplayLayout.Override.ColumnAutoSizeMode =

ColumnAutoSizeMode.VisibleRows;
this.ultraGrid1.DisplayLayout.Bands [1]. Override.ColumnAutoSizeMode =

ColumnAutoSizeMode.AllRowsInBand;
this.ultraGrid1.Rows [0]. PerformAutoSize ();

Traverse the column
grid.Layout.Bands [0]. Columns.FromKey ("Key")
foreach (UltraGridColumn column in e.Layout.Bands [0]. Columns)
column.Width = 100;

Determine whether a column to repeat
public static bool CheckIfSame (UltraGrid ug, string colname)
(
for (int i = 0; i <ug.Rows.Count; i + +)
(
for (int j = i +1; j <ug.Rows.Count; j + +)
if (ug.Rows [i]. Cells [colname]. Text == ug.Rows [j]. Cells [colname]. Text & &

ug.Rows [i]. Cells [colname]. Text! = "")
return true;
)
return false;
)

Add non-binding column
this.ultraGrid1.DisplayLayout.Bands [0]. Columns.Add ("CalculatedColumn", "Calculated

Value ");

Get the number of sub-band data
private int GetNumberofChildBands (Infragistics.Win.UltraWinGrid.UltraGridBand aBand)
(
int GetNumberofChildBands = 0;
foreach (UltraGridColumn aCol in aBand.Columns)
(
if (aCol.IsChaptered)
GetNumberofChildBands = GetNumberofChildBands + 1;
)
return GetNumberofChildBands;
)

Different values can give different colors.
Properties-> DisplayLayout-> bands-> 0-XXX-> Columns-> from the pop-up window, select a column -

> ValueBaseAppearance-> Add Conditions, you can.

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Cell ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Select the cell style
ug.DisplayLayout.Override.SelectedCellAppearance.BackColor = Color.SteelBlue; / / selected cell

Cell selection mode
e.Layout.Override.SelectTypeCell = SelectType.Single;

Format Cells
private void ultraGrid1_InitializeLayout (object sender, InitializeLayoutEventArgs e)
(
/ / Fit columns
e.Layout.AutoFitStyle = AutoFitStyle.ExtendLastColumn;

/ / Create culture objects
CultureInfo cultureENUS = CultureInfo.CreateSpecificCulture ("en-us");
CultureInfo cultureDEDE = CultureInfo.CreateSpecificCulture ("de-de");
CultureInfo cultureJAJP = CultureInfo.CreateSpecificCulture ("ja-jp");

/ / Set date formats
e.Layout.Bands [0]. Columns ["OrderDate"]. Format = "d";
e.Layout.Bands [0]. Columns ["OrderDate"]. FormatInfo = cultureENUS;
e.Layout.Bands [0]. Columns ["RequiredDate"]. Format = "d";
e.Layout.Bands [0]. Columns ["RequiredDate"]. FormatInfo = cultureDEDE;
e.Layout.Bands [0]. Columns ["ShippedDate"]. Format = "d";
e.Layout.Bands [0]. Columns ["ShippedDate"]. FormatInfo = cultureJAJP;
)

Cut long text display mode
this.ultraGrid1.DisplayLayout.Override.CellAppearance.TextTrimming =

TextTrimming.EllipsisCharacter;

Changes the cell background
void UltraGrid1_AfterCellUpdate (...)
(
if (e.Cell.Column.Key == "Column_5")
(
int cellValue = (int) e.Cell.Value;
if (cellValue == 100)
(
e.Cell.Appearance.BackColor = System.Drawing.Color.Red;
)
else
e.Cell.Appearance.BackColor = System.Drawing.Color.White;
)
)

Cell background image
private void ultraGrid1_InitializeLayout (object sender, InitializeLayoutEventArgs e)
(
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. CellAppearance.ImageBackground =
Image.FromFile (System.IO.Path.Combine (
Application.StartupPath, @ ".. \ .. \ ExtraFiles \ Find in Field.bmp"));
)

Cell button style
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. Style = ColumnStyle.Button;
this.ultraGrid1.DisplayLayout.Override.CellButtonAppearance.Image =
Image.FromFile (System.IO.Path.Combine (
Application.StartupPath, @ ".. \ .. \ ExtraFiles \ Find in Field.bmp"));
this.ultraGrid1.DisplayLayout.Bands [0]. Override.ButtonStyle =

UIElementButtonStyle.Button3D;

Multi-line cells
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. CellMultiLine =

DefaultableBoolean.True;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. VertScrollBar = true;
this.ultraGrid1.DisplayLayout.Override.DefaultRowHeight = 100;

Click the cell treatment
this.ultraGrid1.DisplayLayout.Override.CellClickAction =

CellClickAction.EditAndSelectText;

Cell values and keys
this.ultraGrid1.Rows [0]. Cells ["Field Name"]. Value / / value of the cell
cell.Column.Key / / cell attribution of key columns
this.ultraGrid1.Selected.Cells; / / selected cell

Drop-down box to manually set the cell in Properties-> DisplayLayout-> ValueLists, add ValueList
Properties-> DisplayLayout-> bands-> 0-XXX-> Columns-> a Column-> ValueList equal to the newly added

ValueList, while setting a DropDown Style
Would also like to write a Event Handler, so detailed you can see the other Style Link:
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1708
Code set
ValueList locValueList = this.ultraGrid.DisplayLayout.ValueLists.Add ("Locs");
foreach (DataRow dr in m_ds.Tables ["Loc"]. Rows)
locValueList.ValueListItems.Add ((int) (dr ["ID"]), dr ["Name"]. ToString ());
ultraGrid.DisplayLayout.Bands ["Customer"]. Columns ["LocID"]. ValueList =

ultraGrid.DisplayLayout.ValueLists ["Locs"];
ValueList example
ultraGrid1.DisplayLayout.ValueLists.Add ("List1");
ultraGrid1.DisplayLayout.ValueLists ["List1"]. ValueListItems.Add (1, "One");
ultraGrid1.DisplayLayout.ValueLists ["List1"]. ValueListItems.Add (2, "Two");
ultraGrid1.DisplayLayout.ValueLists ["List1"]. ValueListItems.Add (3, "Three");
ultraGrid1.DisplayLayout.ValueLists ["List1"]. DisplayStyle =

ValueListDisplayStyle.DisplayText;
ultraGrid1.DisplayLayout.Bands [0]. Columns.Add ("Notes");
ultraGrid1.DisplayLayout.Bands [0]. Columns ["Notes"]. ValueList =

this.ultraGrid1.DisplayLayout.ValueLists ["List1"];
ultraGrid1.DataBind ();

Set a specific cell in edit mode
this.ultraGrid1.ActiveCell = this.ultraGrid1.ActiveRow.Cells ["CompanyName"];
this.ultraGrid1.Focus ();
this.ultraGrid1.PerformAction (UltraGridAction.EnterEditMode, false, false);

Merge cells merge cells with the same value
this.ultraGrid1.DisplayLayout.Override.MergedCellStyle = MergedCellStyle.Always;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. MergedCellStyle =

MergedCellStyle.Never;
Appearance settings merge cells
this.ultraGrid1.DisplayLayout.Override.MergedCellAppearance.BackColor =

Color.LightYellow;
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. MergedCellAppearance.BackColor =

Color.Blue;
Merge logic: the same text can be combined
this.ultraGrid1.DisplayLayout.Bands [0]. Columns [0]. MergedCellEvaluationType =

MergedCellEvaluationType.MergeSameText;
Custom logic cells combined
private void ultraGrid1_InitializeLayout (object sender,

Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
(
e.Layout.Override.MergedCellStyle = MergedCellStyle.Always;
e.Layout.Bands [0]. Columns ["ShippedDate"]. MergedCellEvaluator = new

CustomMergedCellEvaluator ();
)
public class CustomMergedCellEvaluator:

Infragistics.Win.UltraWinGrid.IMergedCellEvaluator
(
public CustomMergedCellEvaluator () ()
/ / Merge the date of the same cell (no time to exact the same)
public bool ShouldCellsBeMerged (UltraGridRow row1, UltraGridRow row2,

UltraGridColumn column)
(
DateTime date1 = (DateTime) row1.GetCellValue (column);
DateTime date2 = (DateTime) row2.GetCellValue (column);
return date1.Date == date2.Date;
)
)

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ custom cell editor control ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
EmbeddableEditorBase

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ FULL EXAMPLE ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
/ /
/ / UltraDataColumns
/ /
UltraDataColumn ultraDataColumn1 = new UltraDataColumn ("BidId");
UltraDataColumn ultraDataColumn2 = new UltraDataColumn ("BidPaperId");
UltraDataColumn ultraDataColumn3 = new UltraDataColumn ("BidCompanyName");
UltraDataColumn ultraDataColumn4 = new UltraDataColumn ("BidMoney");
UltraDataColumn ultraDataColumn5 = new UltraDataColumn ("ValidBidMoney");
UltraDataColumn ultraDataColumn6 = new UltraDataColumn ("ValidBidRank");
UltraDataColumn ultraDataColumn7 = new UltraDataColumn ("ValidBidRemark");
UltraDataColumn ultraDataColumn8 = new UltraDataColumn ("MoneyScore");
UltraDataColumn ultraDataColumn9 = new UltraDataColumn ("PaperScore");
UltraDataColumn ultraDataColumn10 = new UltraDataColumn ("BusinessScore");
ultraDataColumn1.DataType = typeof (int);
ultraDataColumn2.DataType = typeof (int);
ultraDataColumn5.DataType = typeof (double);
ultraDataColumn8.DataType = typeof (double);
ultraDataColumn9.DataType = typeof (double);
ultraDataColumn10.DataType = typeof (double);

/ /
/ / UltraDataSource
/ /
this.ultraDataSource = new Infragistics.Win.UltraWinDataSource.UltraDataSource

(This.components);
this.ultraDataSource.Band.Columns.AddRange (new object [] (
ultraDataColumn1,
ultraDataColumn2,
ultraDataColumn3,
ultraDataColumn4,
ultraDataColumn5,
ultraDataColumn6,
ultraDataColumn7,
ultraDataColumn8,
ultraDataColumn9,
ultraDataColumn10));

/ /
/ / UltraGridColumns
/ /
UltraGridColumn ultraGridColumn1 = new UltraGridColumn ("BidId");
UltraGridColumn ultraGridColumn2 = new UltraGridColumn ("BidPaperId");
UltraGridColumn ultraGridColumn3 = new UltraGridColumn ("BidCompanyName");
UltraGridColumn ultraGridColumn4 = new UltraGridColumn ("BidMoney");
ultraGridColumn1.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
ultraGridColumn1.Header.VisiblePosition = 0;
ultraGridColumn1.Hidden = true;
ultraGridColumn2.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
ultraGridColumn2.Header.Caption = "No";
ultraGridColumn2.Header.VisiblePosition = 1;
ultraGridColumn2.Hidden = true;
ultraGridColumn3.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
ultraGridColumn3.Header.Caption = "bidder";
ultraGridColumn3.Header.Fixed = true;
ultraGridColumn3.Header.VisiblePosition = 2;
ultraGridColumn3.Width = 159;
ultraGridColumn4.CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
ultraGridColumn4.Header.Caption = "Tender Amount (million)";
ultraGridColumn4.Header.VisiblePosition = 3;
ultraGridColumn4.Width = 108;

/ /
/ / UltraGridBand
/ /
UltraGridBand ultraGridBand1 = new UltraGridBand ("Band 0", -1);
ultraGridBand1.Columns.AddRange (new object [] (
ultraGridColumn1,
ultraGridColumn2,
ultraGridColumn3,
ultraGridColumn4
));

/ /
/ / UltraGrid
/ /
this.grid = new Infragistics.Win.UltraWinGrid.UltraGrid ();
this.grid.DataSource = this.ultraDataSource;
this.grid.DisplayLayout.AutoFitStyle =

Infragistics.Win.UltraWinGrid.AutoFitStyle.ExtendLastColumn;

4, UltraGrid Data Binding

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ Bind ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Bound to IList (display only, can not add remove)
this.ultraGrid1.SetDataBinding (myObjectList, "", true);

Data source bound to the surface (DataTable)
private void ultraButton1_Click (object sender, System.EventArgs e)
(
/ / Declare a DataTable to contain the program generated data
DataTable dataTable = new DataTable ("TableTest");

/ / Create and add a CustomerID column
DataColumn colWork = new DataColumn ("CustomerID", System.Type.GetType

("System.Int32"));
dataTable.Columns.Add (colWork);

/ / Add CustomerID column to key array and bind to DataTable
DataColumn [] Keys = new DataColumn [1];
Keys [0] = colWork;
dataTable.PrimaryKey = Keys;

/ / Create and add a CustomerName column
colWork = new DataColumn ("CustomerName", System.Type.GetType ("System.String"));
colWork.MaxLength = 50;
dataTable.Columns.Add (colWork);

/ / Create and add a LastOrderDate column
colWork = new DataColumn ("LastOrderDate", System.Type.GetType ("System.DateTime"));
dataTable.Columns.Add (colWork);

/ / Add a row
DataRow row = dataTable.NewRow ();
row ["CustomerID"] = 1;
row ["CustomerName"] = "Johns Widgets";
row ["LastOrderDate"] = System.DateTime.Now;
dataTable.Rows.Add (row);

/ / Add another row
row = dataTable.NewRow ();
row ["CustomerID"] = 2;
row ["CustomerName"] = "Freds Thingamagigs";
row ["LastOrderDate"] = System.DateTime.Now.AddDays (-101);
dataTable.Rows.Add (row);

/ / Bind the table to the grid
this.ultraGrid1.DataSource = dataTable;
)

Bound to the data source level (DataSet)
private void ultraButton1_Click (object sender, System.EventArgs e)
(
/ / Declare DataSet to contain Hierarchical data
/ / Make Customers DataTable
/ / Make Orders DataTable
DataSet dataSet = new DataSet ();
dataSet.Tables.Add (MakeCustomersDataTable ());
dataSet.Tables.Add (MakeOrdersDataTable (dataSet.Tables ["Customers "]));

/ / Create customers / orders relationship and add to DataSet
DataRelation relCustOrder = new DataRelation (
"CustOrder"
, DataSet.Tables ["Customers"]. Columns ["CustomerID"]
, DataSet.Tables ["Orders"]. Columns ["CustomerID"]
);
dataSet.Relations.Add (relCustOrder);

/ / Bind the DataSet to the Grid
this.ultraGrid1.DataSource = dataSet;
)
/ / Client List
private DataTable MakeCustomersDataTable ()
(
/ / Declare a DataTable to contain the program generated data
DataTable dataTable = new DataTable ("Customers");

/ / Create and add a CustomerID column
DataColumn colWork = new DataColumn ("CustomerID", System.Type.GetType

("System.Int32"));
dataTable.Columns.Add (colWork);

/ / Add CustomerID column to key array and bind to DataTable
DataColumn [] Keys = new DataColumn [1];
Keys [0] = colWork;
dataTable.PrimaryKey = Keys;

/ / Create and add a CustomerName column
colWork = new DataColumn ("CustomerName", System.Type.GetType ("System.String"));
colWork.MaxLength = 50;
dataTable.Columns.Add (colWork);

/ / Create and add a L = tOrderDate column
colWork = new DataColumn ("L = tOrderDate", System.Type.GetType ("System.DateTime"));
dataTable.Columns.Add (colWork);

/ / Add a row
DataRow row = dataTable.NewRow ();
row ["CustomerID"] = 1;
row ["CustomerName"] = "Johns Widgets";
row ["L = tOrderDate"] = System.DateTime.Now;
dataTable.Rows.Add (row);

/ / Add another row
row = dataTable.NewRow ();
row ["CustomerID"] = 2;
row ["CustomerName"] = "Freds Thingamagigs";
row ["L = tOrderDate"] = System.DateTime.Now.AddDays (-101);
dataTable.Rows.Add (row);

return dataTable;
)
/ / Order Form
private DataTable MakeOrdersDataTable (DataTable v_customersDataTable)
(
/ / Declare a DataTable to contain the program generated data
DataTable dataTable = new DataTable ("Orders");

/ / Create and add a CustomerID column
DataColumn colWork = new DataColumn ("CustomerID", System.Type.GetType

("System.Int32"));
dataTable.Columns.Add (colWork);

/ / Add CustomerID column to key array
DataColumn [] Keys = new DataColumn [2];
Keys [0] = colWork;

/ / Create and add OrderID column
colWork = new DataColumn ("OrderID", System.Type.GetType ("System.String"));
colWork.MaxLength = 15;
dataTable.Columns.Add (colWork);

/ / Add OrderID column to key array and bind to DataTable
Keys [1] = colWork;
dataTable.PrimaryKey = Keys;

/ / Create and add a EmployeeID column
colWork = new DataColumn ("EmployeeID", System.Type.GetType ("System.Int32"));
dataTable.Columns.Add (colWork);

/ / Create and add a OrderDate column
colWork = new DataColumn ("OrderDate", System.Type.GetType ("System.DateTime"));
dataTable.Columns.Add (colWork);

/ / Loop through Customer table and add Order rows
foreach (DataRow custRow in v_customersDataTable.Rows)
(
/ / Add four rows for each Customer
DataRow row;
for (Int32 intPtr = 1; intPtr <= 4; intPtr + +)
(
row = dataTable.NewRow ();
row ["CustomerID"] = custRow ["CustomerID"];
row ["OrderID"] = intPtr * ((Int32) custRow ["CustomerID"]);
row ["EmployeeID"] = intPtr * 10;
row ["OrderDate"] = System.DateTime.Now.AddDays (intPtr);
dataTable.Rows.Add (row);
)
)
return dataTable;
)

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ ■ ■ form control data synchronization
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Synchronize data with form controls
private void DataSourcesandWinGridRows_Load (object sender, System.EventArgs e)
(
this.txtDiscount.DataBindings.Add ("Text", this.winGrid1.Order_Details, "Discount");
this.txtQuantity.DataBindings.Add ("Text", this.winGrid1.Order_Details, "Quantity");
this.txtUnitPrice.DataBindings.Add ("Text", this.winGrid1.Order_Details, "UnitPrice");
)
private void ultraGrid1_InitializeLayout (object sender, InitializeLayoutEventArgs e)
(
e.Layout.Override.SelectTypeRow = SelectType.Single;
e.Layout.Override.CellClickAction = CellClickAction.RowSelect;
)
private void ultraGrid1_AfterSelectChange (object sender, AfterSelectChangeEventArgs e)
(
/ / Use CurrencyManager to set position
CurrencyManager currencyManager1;
currencyManager1 = (CurrencyManager) this.BindingContext [this.winGrid1.Order_Details];
currencyManager1.Position = this.ultraGrid1.Selected.Rows [0]. Index;
)

Synchronization Example 2
private void WinGridasaDataNavigator_Load (object sender, System.EventArgs e)
(
/ / Set data binding for text boxes
this.txtCompanyName.DataBindings.Add ("Text", this.ultraGrid1.DataSource,

"CompanyName");
this.txtContactName.DataBindings.Add ("Text", this.ultraGrid1.DataSource,

"ContactName");
this.txtContactTitle.DataBindings.Add ("Text", this.ultraGrid1.DataSource,

"ContactTitle");
this.txtAddress.DataBindings.Add ("Text", this.ultraGrid1.DataSource, "Address");
this.txtCity.DataBindings.Add ("Text", this.ultraGrid1.DataSource, "City");
this.txtRegion.DataBindings.Add ("Text", this.ultraGrid1.DataSource, "Region");
this.txtPostalCode.DataBindings.Add ("Text", this.ultraGrid1.DataSource,

"PostalCode");
this.txtCountry.DataBindings.Add ("Text", this.ultraGrid1.DataSource, "Country");
)
private void ultraGrid1_InitializeLayout (object sender, InitializeLayoutEventArgs e)
(
/ / Hide all but "CustomerID" column
foreach (UltraGridColumn aColumn in e.Layout.Bands [0]. Columns)
(
switch (aColumn.Key)
(
case "CustomerID":
aColumn.CellActivation = Activation.NoEdit;
break;
default:
aColumn.Hidden = true;
break;
)
)

/ / Configure grid
e.Layout.AutoFitStyle = AutoFitStyle.ResizeAllColumns;
e.Layout.Override.SelectTypeCell = SelectType.None;
e.Layout.Override.SelectTypeCol = SelectType.None;
e.Layout.Override.SelectTypeRow = SelectType.None;
)

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ ■ ■ data acquisition
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Traverse the sub-line traverse line
UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands [1];
foreach (UltraGridRow row in band.GetRowEnumerator (GridRowType.DataRow))
(
)
Traverse all rows, including the sub-band
foreach (UltraGridRow row in this.ultraGrid1.Rows.GetRowEnumerator (

GridRowType.DataRow, null, null))
(
)

Get cell from the protection of the value
private void ultraGrid1_DoubleClickCell (object sender, DoubleClickCellEventArgs e)
(
Point point = Cursor.Position;
point = this.ultraGrid1.PointToClient (point);
UIElement oUI = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint (point);
if (oUI == null)
return;
while (oUI! = null)
(
if (oUI.GetType () == typeof (CellUIElement))
(
CellUIElement oCellUI = (CellUIElement) oUI;
MessageBox.Show ("Cell.Value =" + oCellUI.Cell.Value.ToString ());
)
oUI = oUI.Parent;
)
)

Access to the contents of the specified coordinates cell
UIElement myUIElement = this.ultraGrid1.DisplayLayout.UIElement.ElementFromPoint (new

Point (eX, eY));
UltraGridCell myCell = (UltraGridCell) myUIElement.GetContext (typeof (UltraGridCell));
MessageBox.Show ("You are over a Cell containing" + myCell.Value.ToString ());

Access Control drop-down box cell
private void ultraGrid1_InitializeLayout (object sender, InitializeLayoutEventArgs e)
(
ValueList vlist = new ValueList ();
for (int i = 0; i <20; i + +)
vlist.ValueListItems.Add (i, "name" + i);

e.Layout.Bands [0]. Columns [0]. ValueList = vlist;
e.Layout.Bands [0]. Columns [0]. style = ColumnStyle.DropDown;

EditorWithCombo editor = (EditorWithCombo) this.ultraGrid1.DisplayLayout.Bands

[0]. Columns [0]. Editor;
editor.HasMRUList = true;
editor.MaxMRUItems = 3;
editor.ButtonAlignment = ButtonAlignment.Left;
)

Clipboard operations
Clipboard.SetDataObject (this.ultraGrid1.Selected.Cells);
this.ultraGrid1.DisplayLayout.Override.AllowMultiCellOperations =

AllowMultiCellOperation.Copy | AllowMultiCellOperation.Paste;

■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
■ ■ CRUD ■ ■
■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■ ■
Add lines show new show new row row
this.ultraGrid1.DisplayLayout.Override.AllowAddNew = AllowAddNew.TemplateOnTop;

/ / TemplateOnBottom
Tip Text settings
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowPrompt = "Click here to add

rows ...";
this.ultraGrid1.DisplayLayout.Bands [0]. SpecialRowPromptField = "Address";
Added line style settings
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowCellAppearance.BackColor =

Color.Yellow;
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowCellAppearance.ForeColor =

Color.LightYellow;
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowSpacingBefore = 5;
this.ultraGrid1.DisplayLayout.Override.TemplateAddRowSpacingAfter = 5;
this.ultraGrid1.DisplayLayout.Override.BorderStyleTemplateAddRow =

UIElementBorderStyle.Inset;
Increase the line:
this.ultraGrid1.Rows.Band.AddNew ();
Added value of filling line
this
  • del.icio.us
  • StumbleUpon
  • Digg
  • TwitThis
  • Mixx
  • Technorati
  • Facebook
  • NewsVine
  • Reddit
  • Google
  • LinkedIn
  • YahooMyWeb

Related Posts of Transfer: Infragistics netadvantage UltraGrid (UltraWinGrid) Programming Notes

  • Review jsf + spring + hibernate (1)

    Writing the code a long time, a lot of the framework of the basic debugging question had been forgotten even today, specifically the most easy to write a framework, including the presentation layer from the call to the database layer. Perhaps the whole fl

  • To become a Java expert need to pay attention to learning objectives 25

    1. You need to proficient in Object-Oriented Analysis and Design (OOA / OOD), involving patterns (GOF, J2EEDP), as well as an integrated approach. You should know UML, especially class, object, interaction, and statediagrams. 2. You need to learn the basi

  • Hibernate's search method

    Hibernate provides the following types of object retrieval approach. l navigation object graph search method. (Based on the object is already loaded, navigate to other objects.) l OID retrieval methods. (In accordance with the OID object to retrieve the o

  • Java Enterprise System architecture selection considerations

    Java Enterprise System architecture selection considerations Source: Network Java is now the flourishing of a variety of technical fields, under various names, how to select according to their own needs then these frameworks? Especially for beginners, stu

  • ADO.NET completed hibernate things did not complete

    Recently to do. NET platform, C # + SPRING.NET + Nhibernate development, has been to do before. NET + SQL SERVER2005 development, comparing the difference here, to express some opinion Whether we are using hibernate or nhibernate, back at the data fr ...

  • Java web projects unit and integration testing

    Writing a few years ago, and for colleagues to consider to find out easily posted on here, the article a bit long, put in the attachment The importance of unit testing has long been popular, test-driven development with the last two years the promoti ...

  • 12 The most important J2EE best practices (transfer)

    12 The most important J2EE best practices (transfer) Best Practices: 1, always use the MVC framework. 2, at each level are the application of automated unit testing and test management. 3, in accordance with the norms for the development, rather than in a

  • RIA + REST how to resolve Java disadvantage

    java where the disadvantage? compared with previous years, and now the look is very clear, Java's disadvantage lies in the performance of layers to do Web development. Web Presentation Layer development needs change frequently, Java statically typed l

  • Java technology 25 study points

    1. You need to master the object-oriented analysis and design (OOA / OOD), involving patterns (GOF, J2EEDP) as well as the integrated model. You should understand the UML, especially class, object, interaction and statediagrams. 2. You need to learn basic

  • Java Technology wishing cow needed 25 points of study

    1. You need to master the object-oriented analysis and design (OOA / OOD), involving patterns (GOF, J2EEDP) as well as the integrated model. You should understand the UML, especially class, object, interaction and statediagrams. 2. You need to learn basic

blog comments powered by Disqus
Recent
Recent Entries
Tag Cloud
Random Entries