1

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   
   |
  \_/

enter image description here

4

2 回答 2

1

我不知道为什么,但调用它BeginInvoke解决了这个问题。

BeginInvoke(New MethodInvoker(AdressOf SetFocusToRow))

Private sub SetFocusToRow()
{
  myUltraWinGrid.ActiveCell = myUltraWinGrid.ActiveRow.Cells("foo")
  myUltraWinGrid.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode)
}
于 2013-04-24T17:54:21.703 回答
-1

因为由于某种原因它被另一个线程执行

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

于 2015-07-30T20:58:06.360 回答