Home Forums WinForms controls Xceed Grid for WinForms insertionrow boolean Reply To: insertionrow boolean

User (Old forums)
Post count: 23064


The previous answer won’t clear the checkbox on the InsertionRow.  It will still appear as a full green square.  To get rid of this green square, here is a possibility:

include Xceed.Grid.Editors and Xceed.Grid.Viewers in your project, include this in your Form1.vb  

and, it your Form1 class:

Public Sub New()
  Xceed.Grid.Licenser.LicenseKey = “(your license key here)” 
  gridControl1.SingleClickEdit = True  ‘  change a checkbox value with a single click even if it’s not already selected, takes two clicks otherwise
  If insertionRow1 IsNot Nothing AndAlso insertionRow1.Cells(1) IsNot Nothing Then
   insertionRow1.Cells(“column2”).CellEditorManager = New CheckBoxEditor()
   insertionRow1.Cells(“column2”).CellViewerManager = New CheckBoxViewer()
   CType(insertionRow1.Cells(“column2”), InsertionCell).IdleValue = False  ‘  The idle value is what you see when the insertion row is not activated yet
  End If
End Sub

and you will also need this to put the IdleValue of the InsertionCell into the row that is being added:

Private Sub gridControl1_AddingDataRow(ByVal sender As Object, ByVal e As AddingDataRowEventArgs) Handles gridControl1.AddingDataRow
  e.DataRow.Cells(“column2”).Value = (CType(insertionRow1.Cells(“column2”), InsertionCell)).IdleValue
End Sub

In a certain way, the insertion row is a template for the rows that will be added, as long as it is not activated.  It becomes activated when one of the IdleValues is changed.  The IdleValue is not automatically transfered in the Value field.  In the example above, I took for granted that your grid was named gridControl1, the column with the boolean value was “column2” and the insertion row was insertionRow1.  If your instances have different names, do the changes as needed.

Imported from legacy forums. Posted by Ghislain (had 1548 views)