XtraGrid:获取 RespositoryItemButtonEdit 行索引
XtraGrid: Get RespositoryItemButtonEdit row index
如何在特定行索引处获取 ButtonEdit
?
这就是我创建 RepositoryItemButtonEdit
列的方式。
Private Sub PopulateDataGrid()
GrdCntrlMain.DataSource = CreateDataSet().Tables(TABLE_WORKERS)
Dim lObj_GrdClmn As GridColumn = GrdView.Columns.AddField("Select") ' This is my RepositoryItemButtonEdit column
With lObj_GrdClmn
.VisibleIndex = GrdView.Columns.Count
.OptionsColumn.AllowEdit = True
End With
GrdView.OptionsView.RowAutoHeight = False
AddHandler GrdView.MouseMove, AddressOf GrdView_MouseMove
Dim lObj_RepItm_BtnEdt As New RepositoryItemButtonEdit
lObj_RepItm_BtnEdt.TextEditStyle = TextEditStyles.HideTextEditor
AddHandler lObj_RepItm_BtnEdt.ButtonPressed, AddressOf lObj_EdtrBtn_Click
Dim lObj_EdtrBtn As EditorButton = New EditorButton()
lObj_EdtrBtn.Kind = ButtonPredefines.Glyph
lObj_EdtrBtn.Appearance.BackColor = Color.Azure
lObj_EdtrBtn.Caption = "Remove"
lObj_EdtrBtn.Appearance.Options.UseTextOptions = True
lObj_RepItm_BtnEdt.Buttons.Clear()
lObj_RepItm_BtnEdt.Buttons.Add(lObj_EdtrBtn)
GrdCntrlMain.RepositoryItems.Add(lObj_RepItm_BtnEdt)
GrdView.Columns("Select").ColumnEdit = lObj_RepItm_BtnEdt
End Sub
我想在第 6 行获取按钮,如图中突出显示的那样。
假设我想在 CellValueChanged
事件中获得此按钮。
我怎样才能得到这个按钮?
Cell values are edited by editors inherited from the BaseEdit class.
Once a user starts to edit a cell value, the cell's editor is created.
When editing is complete, the cell editor is destroyed. Thus, there
can be only one active editor instance at any moment.
所以,如果你想从单元格中获取编辑器,你需要聚焦这个单元格并开始编辑它。使用 ColumnView.FocusedRowHandle
property and ColumnView.FocusedColumn
property to set the focus on cell and call to GridView.ShowEditor
method to invoke the editor. After that use ColumnView.ActiveEditor
属性 获取您的编辑器:
GrdView.FocusedRowHandle = 5 'The 6-th row handle.
GrdView.FocusedColumn = GrdView.Columns("Select")
GridView.ShowEditor
Dim editor = GridView.ActiveEditor
如何在特定行索引处获取 ButtonEdit
?
这就是我创建 RepositoryItemButtonEdit
列的方式。
Private Sub PopulateDataGrid()
GrdCntrlMain.DataSource = CreateDataSet().Tables(TABLE_WORKERS)
Dim lObj_GrdClmn As GridColumn = GrdView.Columns.AddField("Select") ' This is my RepositoryItemButtonEdit column
With lObj_GrdClmn
.VisibleIndex = GrdView.Columns.Count
.OptionsColumn.AllowEdit = True
End With
GrdView.OptionsView.RowAutoHeight = False
AddHandler GrdView.MouseMove, AddressOf GrdView_MouseMove
Dim lObj_RepItm_BtnEdt As New RepositoryItemButtonEdit
lObj_RepItm_BtnEdt.TextEditStyle = TextEditStyles.HideTextEditor
AddHandler lObj_RepItm_BtnEdt.ButtonPressed, AddressOf lObj_EdtrBtn_Click
Dim lObj_EdtrBtn As EditorButton = New EditorButton()
lObj_EdtrBtn.Kind = ButtonPredefines.Glyph
lObj_EdtrBtn.Appearance.BackColor = Color.Azure
lObj_EdtrBtn.Caption = "Remove"
lObj_EdtrBtn.Appearance.Options.UseTextOptions = True
lObj_RepItm_BtnEdt.Buttons.Clear()
lObj_RepItm_BtnEdt.Buttons.Add(lObj_EdtrBtn)
GrdCntrlMain.RepositoryItems.Add(lObj_RepItm_BtnEdt)
GrdView.Columns("Select").ColumnEdit = lObj_RepItm_BtnEdt
End Sub
我想在第 6 行获取按钮,如图中突出显示的那样。
假设我想在 CellValueChanged
事件中获得此按钮。
我怎样才能得到这个按钮?
Cell values are edited by editors inherited from the BaseEdit class. Once a user starts to edit a cell value, the cell's editor is created. When editing is complete, the cell editor is destroyed. Thus, there can be only one active editor instance at any moment.
所以,如果你想从单元格中获取编辑器,你需要聚焦这个单元格并开始编辑它。使用 ColumnView.FocusedRowHandle
property and ColumnView.FocusedColumn
property to set the focus on cell and call to GridView.ShowEditor
method to invoke the editor. After that use ColumnView.ActiveEditor
属性 获取您的编辑器:
GrdView.FocusedRowHandle = 5 'The 6-th row handle.
GrdView.FocusedColumn = GrdView.Columns("Select")
GridView.ShowEditor
Dim editor = GridView.ActiveEditor