XtraGrid中:获取RespositoryItemButtonEdit行的索引 [英] XtraGrid: Get RespositoryItemButtonEdit row index
问题描述
如何获得 ButtonEdit
在特定行的索引?
How to get ButtonEdit
at specific row index?
这是我如何创建 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 排在形象突出。
I want to get button at 6th row as highlighted in image.
让说,我想这个按钮 CellValueChanged
事件。
Let say I want to get this button on CellValueChanged
event.
我怎样才能得到这个按钮?
How I can get this button?
推荐答案
据<一href="https://documentation.devex$p$pss.com/#WindowsForms/DevEx$p$pssXtraGridViewsBaseColumnView_ActiveEditortopic"相对=nofollow>文档:
单元格值由编辑从BaseEdit类继承编辑。 一旦用户开始编辑单元格值,细胞的编辑器创建的。 当编辑完成后,单元格编辑器被破坏。因此,存在 可以在任何时刻只有一个活动的编辑器实例。
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.
所以,如果你想从小区的编辑器,你需要关注该小区,并开始对其进行编辑。使用<一个href="https://documentation.devex$p$pss.com/#WindowsForms/DevEx$p$pssXtraGridViewsBaseColumnView_FocusedRowHandletopic"相对=nofollow> ColumnView.FocusedRowHandle
财产和<一href="https://documentation.devex$p$pss.com/#WindowsForms/DevEx$p$pssXtraGridViewsBaseColumnView_FocusedColumntopic"相对=nofollow> ColumnView.FocusedColumn
属性来设置焦点单元,并呼吁为<一个href="https://documentation.devex$p$pss.com/#WindowsForms/DevEx$p$pssXtraGridViewsGridGridView_ShowEditortopic"相对=nofollow> GridView.ShowEditor
方法来调用编辑器。即使用<一后href="https://documentation.devex$p$pss.com/#WindowsForms/DevEx$p$pssXtraGridViewsBaseColumnView_ActiveEditortopic"相对=nofollow> ColumnView.ActiveEditor
属性来获取你的编辑器:
So, if you want to get the editor from the cell, you need to focus this cell and start to edit it. Use the 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
property to get your editor:
GrdView.FocusedRowHandle = 5 'The 6-th row handle.
GrdView.FocusedColumn = GrdView.Columns("Select")
GridView.ShowEditor
Dim editor = GridView.ActiveEditor
这篇关于XtraGrid中:获取RespositoryItemButtonEdit行的索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!