I've created a class that derives from Infragistics.Win.UltraWinGrid.UltraGrid, and I'm trying to set Me.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect, but when the control is dropped on a parent, the value always ends up being EditAndSelectText.
Here is my code. I've also tried it in the constructor with same results:
Protected Overrides Sub InitLayout() Try MyBase.InitLayout() Me.DisplayLayout.GroupByBox.Hidden = True Me.DisplayLayout.Override.AllowUpdate = Infragistics.Win.DefaultableBoolean.[False] Me.DisplayLayout.Override.CellClickAction = Infragistics.Win.UltraWinGrid.CellClickAction.RowSelect Me.DisplayLayout.Override.HeaderClickAction = Infragistics.Win.UltraWinGrid.HeaderClickAction.SortMulti Me.DisplayLayout.Override.RowSelectors = Infragistics.Win.DefaultableBoolean.[False] Me.DisplayLayout.Override.SelectTypeRow = Infragistics.Win.UltraWinGrid.SelectType.Single 'default until set otherwise. Catch ex As Exception BSExceptionHandler.ProcessException(BSExceptionHandler.GetBSException(ex, BSExceptionHandler.GetThisMethodName)) End Try End Sub
Hello,
The timing inwhich you are calling these properties appears to be too soon while the app is executing.
CellClickAction defaults to EditAndSelectText when the control is dragged onto a form for the first time. And the code you have placed within InitLayout will not be called until the DataSource or Datamember of the grid is updated.
I recommend waiting until the data is bound to the grid before updating these properties.
Let me know if you have any questions regarding this matter.
I want my derived control to default to "RowSelect" for CellClickAction. I'm not sure when the consumers of the control will set the data source, but it shouldn't have to wait until after that to set the CellClickAction. In fact, it wouldn't be good in cases where the consumers of the control set the CellClickAction to something else before setting the data source.
There must be another option, right? Even if I don't derive the UltraGrid control, I can place it on a form, set the CellClickAction to RowSelect in the designer before setting the data source, and the RowSelect sticks. So why can't I do that in a derived class?
Alternatively, you can set a preset with RowSelect and load that preset each time a new instance is added to your form.
For more details about Working with Presets, please refer to our documentation.