UltraWinGrid enter edit mode issue

橙三吉。 提交于 2019-12-24 05:56:59

问题


I have an UltraWinGrid and I want to give the focus to a specific cell and make it enter edit mode programmatically (no click). So I did this :

If myUltraWinGrid.ActiveRow IsNot Nothing Then
myUltraWinGrid.ActiveCell = myUltraWinGrid.ActiveRow.Cells("foo")
myUltraWinGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)
Else
myUltraWinGrid.ActiveCell = myUltraWinGrid.Rows(0).Cells("foo")
myUltraWinGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)
EndIf

Which should work but it only gives focus to the row (no edit mode).

fooColumn   
   |
  \_/


回答1:


I don't know why but calling it with BeginInvoke solved the issue.

BeginInvoke(New MethodInvoker(AdressOf SetFocusToRow))

Private sub SetFocusToRow()
{
  myUltraWinGrid.ActiveCell = myUltraWinGrid.ActiveRow.Cells("foo")
  myUltraWinGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)
}



回答2:


Because it's executed by another thread by some reason

myUltraWinGrid.BeginInvoke(new MethodInvoker(()=> myUltraWinGrid.PerformAction(UltraGridAction.EnterEditMode)));



来源:https://stackoverflow.com/questions/16195640/ultrawingrid-enter-edit-mode-issue

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!