Srinivas Miriyala's Blog


Friday, March 5, 2010

Infragistics UltraWinGrid useful tips

Hide group header box:
In grid InitializeLayout event handler, set

e.Layout.GroupByBox.Hidden = True

Hide row selectors:
In grid InitializeLayout event handler, set

e.Layout.Override.RowSelectors = DefaultableBoolean.False

Selecting single row:
In grid InitializeLayout event handler, set

e.Layout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single

Fixed Columns
In grid InitializeLayout event handler, set

e.Layout.UseFixedHeaders = true;
UltraGrid.Bands[0].Columns[0].Header.Fixed = true;
UltraGrid.Bands[0].Columns[1].Header.Fixed = true;

Change cell button properties/appeacence
In grid InitializeLayout event handler, use

e.Layout.Bands(0).Columns("ButtonCell").CellButtonAppearance

Disable Column Sorting
In grid InitializeLayout event handler, set

with e.Layout
.Override.HeaderClickAction = HeaderClickAction.Select
.Override.SelectTypeCol = SelectType.None
End With

To enable immediate scrolling
In grid InitializeLayout event handler, set

with e.Layout
.ScrollBounds = ScrollBounds.ScrollToFill
.ScrollStyle = ScrollStyle.Immediate
End With

Update datasource for each cell change
In grid InitializeLayout event handler, set

UltraGrid1.UpdateMode = Infragistics.Win.UltraWinGrid.UpdateMode.OnCellChange

To change grid Header Appearance
In grid InitializeLayout event handler, use

UltraGrid1.DisplayLayout.Bands(0).Override.HeaderAppearance property

To disable column swapping, moving,sizing and GroupBy
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Override.AllowColMoving = AllowColMoving.NotAllowed
.Override.AllowColSwapping = AllowColSwapping.NotAllowed
.Override.AllowColSizing = AllowColSizing.None
.Override.AllowGroupBy = DefaultableBoolean.False
End With

Show header text in multi line
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Override.WrapHeaderText = DefaultableBoolean.False
.ColHeaderLines = 2 'two lines
.Columns(0).Header.Caption = "text1" & Environment.NewLine & "text2"
End With

To select a full row if click on any cell
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Override.CellClickAction = CellClickAction.RowSelect
End With

Hide a column
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns("ColumnName").Hidden = True
End With

Adding DropDownList column
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns("ColumnName").Style = ColumnStyle.DropDownList
.Columns("ColumnName").ValueList = UltraGrid1.DisplayLayout.ValueLists("sample")
End With

' create UltraWinGrid Value List
UltraGrid1.DisplayLayout.ValueLists.Add("sample")
With UltraGrid1.DisplayLayout.ValueLists("sample").ValueListItems

Dim aVLI As New ValueListItem()

aVLI.DataValue = 1
aVLI.DisplayText = "Item 1"
.Add(aVLI)

aVLI = New ValueListItem()
aVLI.DataValue = 2
aVLI.DisplayText = "Item 2"
.Add(aVLI)

aVLI = New ValueListItem()
aVLI.DataValue = 3
aVLI.DisplayText = "Item 3"
.Add(aVLI)

End With


Adding a button column
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns(0).Style = ColumnStyle.Button
.Columns(0).ButtonDisplayStyle = UltraWinGrid.ButtonDisplayStyle.Always
End With

To make cell text multi line
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns(0).CellMultiLine = DefaultableBoolean.True
End With

UltraGrid1.DisplayLayout.Bands(0).Columns(0).VertScrollBar = True

You may want to increase the default row height of the grid to better illustrate this sample.

UltraGrid1.DisplayLayout.Override.DefaultRowHeight = 800

To change column header text
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns(0).Header.Caption = "My header"
End With

To change date column format
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns(0).Format = "dd/mm/yyyy hh:mm:ss"
End With

Adding an image to a cell
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns(0).CellButtonAppearance.Image = My.Resources.ImageName 'Add an image to resource file to access from My.Resources
End With

To make Editable/Non Editable column
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.Columns(0).CellActivation = Activation.AllowEdit ' to allow edit
.Columns(0).CellActivation = Activation.NoEdit ' to lock the cell
End With

To add a band header
In grid InitializeLayout event handler, set

With UltraGrid1.DisplayLayout.Bands(0).
.HeaderVisible = True
.Header.Caption = "My Header"
.Header.Appearance.TextHAlign = HAlign.Center
End With

To reset the sorted columns when unloading then reloading your data
ultraGrid1.DisplayLayout.Bands[0].SortedColumns.Clear()

Do not show Expansion Indicator when there are no child items/band
In grid InitializeLayout event handler, set

UltraGrid1.DisplayLayout.Bands(0).Override.ExpansionIndicator = ShowExpansionIndicator.CheckOnDisplay

Labels: , , , , , , , ,

16 Comments:

At August 11, 2010 at 5:50 AM , Blogger Kavita said...

Very cool and useful tips!

 
At September 1, 2010 at 8:34 AM , Blogger Unknown said...

nice tips.and thnx..

 
At February 2, 2019 at 1:20 AM , Blogger Unknown said...

The knowledge of technology you have been sharing thorough this post is very much helpful to develop new idea. here by i also want to share this.
AWS Training in Bangalore
AWS training in sholinganallur
AWS training in Tambaram
AWS training in Velachery

 
At March 16, 2019 at 5:03 AM , Blogger Sharmila Rani said...

This comment has been removed by the author.

 
At June 26, 2020 at 9:12 AM , Blogger Deepa said...

This comment has been removed by the author.

 
At June 30, 2020 at 9:00 AM , Blogger Aadhya said...

This comment has been removed by the author.

 
At June 30, 2020 at 9:17 AM , Blogger Vennala said...

This comment has been removed by the author.

 
At July 1, 2020 at 11:20 AM , Blogger Vennala said...

This comment has been removed by the author.

 
At July 1, 2020 at 12:10 PM , Blogger Aadhya said...

This comment has been removed by the author.

 
At July 2, 2020 at 11:25 AM , Blogger Austin said...

Such an excellent and interesting blog, do post like this more with more information, this was very useful.  Salesforce Training India   

 
At July 8, 2020 at 11:29 AM , Blogger Eva.William said...

This comment has been removed by the author.

 
At July 25, 2020 at 11:23 AM , Blogger Aadhya said...

This comment has been removed by the author.

 
At July 31, 2020 at 5:47 AM , Blogger Vennala said...

This comment has been removed by the author.

 
At August 12, 2020 at 8:25 AM , Blogger Nick569 said...

Great post! I am actually getting ready to across this information, It’s very helpful for this blog. Also great with all of the valuable information you have Keep up the good work you are doing well.
CRS Info Solutions Salesforce training for beginners         

 
At September 1, 2020 at 8:55 AM , Blogger jeni said...

.I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.


oracle training in chennai

oracle training in velachery

oracle dba training in chennai

oracle dba training in velachery

ccna training in chennai

ccna training in velachery

seo training in chennai

seo training in velachery



 
At September 1, 2020 at 8:57 AM , Blogger jeni said...

.I simply wanted to thank you so much again. I am not sure the things that I might have gone through without the type of hints revealed by you regarding that situation.


oracle training in chennai

oracle training in velachery

oracle dba training in chennai

oracle dba training in velachery

ccna training in chennai

ccna training in velachery

seo training in chennai

seo training in velachery



 

Post a Comment

Subscribe to Post Comments [Atom]

<< Home