Home Forums WinForms controls Xceed Grid for WinForms Horizontal scroll is moving to right Reply To: Horizontal scroll is moving to right

User (Old forums)
Post count: 23064


  In my application I need to use xceed grid using master-child relation and there  should be a checkbox in evevery datarow (master grid and child grid or detailgrid) in fist column.

  And one more restriction is user  should be able to check only one row (if user checks one checkbox then

  other checkbox of each datarow (master and detailgrid) should be unchecked).


  To implement this I wrote below the code.  But on binding the items to my xceed grid horizontal scroll is

  moving to the right side slightly and one more is when I check checkbox taking some time to select(check).


  Please suggest me on this… Thanks in advance.


    Private Sub bindDatatoXceedGrid(ByVal ds As DataSet)





   xgcDirect.SingleClickEdit = True

    xgcDirect.FixedColumnSplitter.Visible = False

    xgcDirect.DataRowTemplate.CanBeSelected = False

    xgcDirect.DataRowTemplate.FitHeightToEditors = True

    xgcDirect.SynchronizeDetailGrids = True

    Dim columnDescription As New Column(“Selected”, GetType(Boolean))


    Dim simpleCheckBox As New CheckBoxEditor

    xgcDirect.Columns(“Selected”).CellEditorManager = simpleCheckBox

    AddHandler xgcDirect.AddingDataRow, AddressOf Me.grid_AddingDataRow

   xgcDirect.SetDataBinding(ds, “Master”)



   xgcDirect.Title = “Master 1572”


   If FrmDirect_ChkShwMasterSub1572.Checked And ds.Tables.Contains(“MasterSub”) Then

     Dim data_relationPISub As New DataRelation(“PISub”,  ds.Tables(“Master”).Columns(“Form ID”), ds.Tables(“MasterSub”).Columns(“Form ID”))

     If Not ds.Relations.Contains(“PISub”) Then


     End If

     Dim detailGridTemplateInv As New DetailGrid()

     Dim detailcolumnDescription As New Column(“Selected”, GetType(Boolean))


     Dim detailsimpleCheckBox As New CheckBoxEditor

     detailGridTemplateInv.Columns(“Selected”).CellEditorManager = detailsimpleCheckBox

     AddHandler detailGridTemplateInv.AddingDataRow, AddressOf Me.grid_AddingDataRow

     detailGridTemplateInv.SetDataBinding(ds, “Master.PISub”)

     detailGridTemplateInv.Collapsed = True

     detailGridTemplateInv.HeaderRows.Add(New ColumnManagerRow())


     For i As Integer = 1 To detailGridTemplateInv.Columns.Count – 1

        detailGridTemplateInv.Columns(i).ReadOnly = True


   End If

  End Sub


  Private Sub grid_AddingDataRow(ByVal sender As Object, ByVal e As Xceed.Grid.AddingDataRowEventArgs)

    e.DataRow.Cells(“Selected”).Value = False

    Dim tmpObj As Object

    tmpObj = e.DataRow.Cells(“Selected”).CellEditorControl

    AddHandler   e.DataRow.Cells(“Selected”).CellEditorManager.ActivatingControl, AddressOf CellEditorManager_ActivatingControl

    AddHandler e.DataRow.Cells(“Selected”).CellEditorManager.DeactivatingControl, AddressOf CellEditorManager_DeactivatingControl

    End Sub


  Private Sub CellEditorManager_ActivatingControl(ByVal sender As Object, ByVal e As CellEditorEventArgs)

   AddHandler DirectCast(e.Control, Xceed.Editors.WinCheckBox).CheckedChanged, AddressOf selected_checked

  End Sub


  Private Sub CellEditorManager_DeactivatingControl(ByVal sender As Object, ByVal e As CellEditorEventArgs)

   RemoveHandler DirectCast(e.Control, Xceed.Editors.WinCheckBox).CheckedChanged, AddressOf selected_checked

    End Sub


  Private Sub selected_checked(ByVal sender As Object, ByVal e As System.EventArgs)

  If bSelectChanged Then

  For i As Integer = 0 To xgcDirect.DataRows.Count – 1

    bSelectChanged = False

    xgcDirect.DataRows(i).Cells(“Selected”).Value = False

    For j As Integer = 0 To xgcDirect.DataRows(i).DetailGrids.Count – 1

   For k As Integer = 0 To xgcDirect.DataRows(i).DetailGrids(j).DataRows.Count – 1

 xgcDirect.DataRows(i).DetailGrids(j).DataRows(k).Cells(“Selected”).Value = False




  bSelectChanged = True

  End If

    End Sub



Imported from legacy forums. Posted by pravi (had 594 views)