Hello,
I've got an ExplorerBar setup as ListBar with ControlContainers as content. The ControlContainers contain different controls (grid, texteditor).
I want the first editable control in a group to automatically get focus when the group is folded open. So when the user clicks a group which contains a texteditor control; the group should open and the text editor should immediately have focus so the user can start typing at once.
I tried almost every event the ExplorerBar offers, but none will do the trick. I tried Select / Focus in the ActiveGroupChanged event on both the container as the control in the container, but without luck unfortunately.
Try SelectedGroupChanged
Tried this:
private void finishUltraExplorerBar_SelectedGroupChanged(object sender, Infragistics.Win.UltraWinExplorerBar.GroupEventArgs e){ if (e.Group.Container.Controls[0] is UltraTextEditor) { UltraTextEditor textEditor = (UltraTextEditor)e.Group.Container.Controls[0]; textEditor.Focus(); textEditor.SelectAll(); }}
Doesn't seem to work, it's the proper control but theres no focus or selection after the group change.
It is possible that at the time the event fires the control is not in a selectable state; try calling the method asynchronously:
// Defines the signature for a method that takes an UltraTextEditor as a parameter.delegate void UltraTextEditorHandler( UltraTextEditor textEditor );
// Handles the ExplorerBar's 'SelectedGroupChanged' eventprivate void ultraExplorerBar1_SelectedGroupChanged( object sender, GroupEventArgs e ){ UltraTextEditor textEditor = e.Group.Container.Controls[0] as UltraTextEditor; this.BeginInvoke( new UltraTextEditorHandler(this.SelectTextEditor), new object[]{ textEditor } );}
// Activates the specified UltraTextEditor and selects all text.private void SelectTextEditor( UltraTextEditor textEditor ){ textEditor.Select(); textEditor.SelectAll();}