'Declaration Public Event BeforeAutoSizeEdit As CancelableAutoSizeEditEventHandler
public event CancelableAutoSizeEditEventHandler BeforeAutoSizeEdit
The event handler receives an argument of type CancelableAutoSizeEditEventArgs containing data related to this event. The following CancelableAutoSizeEditEventArgs properties provide information specific to this event.
Property | Description |
---|---|
AddExtraLineForPadding | Gets/Sets an extra line for padding. |
Cancel (Inherited from System.ComponentModel.CancelEventArgs) | |
MaxHeight | Gets or sets the max height of the edit control. |
MaxWidth | Gets or sets the max wdith of the edit control. |
MultiLineTextboxHeightPadding | Gets/Sets the height of padding that will be added at the bottom of the text area. |
StartHeight | Gets or sets the starting height of the edit control. |
StartWidth | Gets or sets the starting width of the edit control. |
This event can be used to adjust the size of the multiple-line edit window or prevent it from being displayed at all.
This event is passed a CancelableAutoSizeEditEventArgs object which contains information about the multi-line edit window that is about to be displayed. You can set the properties of this object to determine the appearance and behavior of the edit window. You can specify both the edit window's initial size (using the StartHeight and StartWidth properties) and its maximum size (using the MaxHeight and MaxWidth properties).
You can also cancel the display of the edit window. The cancel property of the object enables you to programmatically prevent the multiple-line edit window from being displayed. You can use this ability to make the display of the multi-line edit window conditional.
Imports Infragistics.Shared Imports Infragistics.Win Imports Infragistics.Win.UltraWinGrid Private Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button6.Click ' Following code enables auto-size-edit feature on the Address column. ' It also makes the column multiline. Me.ultraGrid1.DisplayLayout.Bands(0).Columns("Address").AutoSizeEdit = DefaultableBoolean.True Me.ultraGrid1.DisplayLayout.Bands(0).Columns("Address").CellMultiLine = DefaultableBoolean.True End Sub Private Sub UltraGrid1_BeforeAutoSizeEdit(ByVal sender As Object, ByVal e As Infragistics.Win.UltraWinGrid.CancelableAutoSizeEditEventArgs) Handles ultraGrid1.BeforeAutoSizeEdit ' BeforeAutoSizeEdit gets fired when a cell in a column with AutoSizeEdit set to True ' is going into edit mode. ' Set the start width of the edit control. This is the width the edit control in the ' cell will start out with. If Me.ultraGrid1.ActiveCell.Column.Width < 250 Then e.StartWidth = 250 End If If Me.ultraGrid1.ActiveCell.Column.CellMultiLine = DefaultableBoolean.True And Me.ultraGrid1.ActiveCell.Row.Height < 100 Then e.StartHeight = 100 End If ' Set the max width and height. The UltraGrid will not resize the edit control ' larger than max height and max width. e.MaxHeight = 400 e.MaxWidth = 400 ' One can cancel auto-size-edit in which case the cell will do regular editing. Dim cancelAutoSizeEdit As Boolean = False If cancelAutoSizeEdit Then e.Cancel = True End Sub
using Infragistics.Shared; using Infragistics.Win; using Infragistics.Win.UltraWinGrid; using System.Diagnostics; private void button6_Click(object sender, System.EventArgs e) { // Following code enables auto-size-edit feature on the Address column. // It also makes the column multiline. this.ultraGrid1.DisplayLayout.Bands[0].Columns["Address"].AutoSizeEdit = DefaultableBoolean.True; this.ultraGrid1.DisplayLayout.Bands[0].Columns["Address"].CellMultiLine = DefaultableBoolean.True; } private void ultraGrid1_BeforeAutoSizeEdit(object sender, Infragistics.Win.UltraWinGrid.CancelableAutoSizeEditEventArgs e) { // BeforeAutoSizeEdit gets fired when a cell in a column with AutoSizeEdit set to True // is going into edit mode. // Set the start width of the edit control. This is the width the edit control in the // cell will start out with. if ( this.ultraGrid1.ActiveCell.Column.Width < 250 ) e.StartWidth = 250; if ( this.ultraGrid1.ActiveCell.Column.CellMultiLine == DefaultableBoolean.True && this.ultraGrid1.ActiveCell.Row.Height < 100 ) e.StartHeight = 100; // Set the max width and height. The UltraGrid will not resize the edit control // larger than max height and max width. e.MaxHeight = 400; e.MaxWidth = 400; // One can cancel auto-size-edit in which case the cell will do regular editing. bool cancelAutoSizeEdit = false; if ( cancelAutoSizeEdit ) e.Cancel = true; }
Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2