Focus

Sep 6, 2010 at 3:06 AM

Has anyone tried setting initial keyboard focus to the IntelliBox's text element?

I think it is a WPF focus implementation quirk that makes it difficult to do before the content is rendered (ie. won't work even in the Loaded event)

I've tried using (in the Page Loaded event);

 

ib.Focus();

 

and (in the Page Loaded event);

 

Keyboard.Focus(ib);

 

and (in the Page xaml);

 

FocusManager.FocusedElement="{Binding ElementName=ib}"

 

The only thing I've found which works is (in the Page Loaded event);

 

ib.Focus();
ib.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

It seems to me that a lot of people find setting focus with UserControls to be quite annoying, I certainly can't find any way that the IntelliBox will be the initial Keyboard focus so that the user can begin typing without clicking or tab'ing.