Unable to receive focuse after navigation

Topics: Prism v4 - WPF 4
Nov 7, 2011 at 6:49 AM
Edited Nov 7, 2011 at 6:51 AM

After navigate between views in the same region i am unable to got focus on the target view.

In this case the Shell view received the focus instead of the current view.

Starting navigation:

 RegionManager.RequestNavigate(RegionNames.MainRegion, new Uri(ViewNames.TargetView + query.ToString(), UriKind.Relative));

On the target ViewModel the request is handled by an implementation of the INavigationAware.

The last call on the callstack i recognist happen on the Shell-Codebehind EventHandler:

 this.GotFocus += new RoutedEventHandler(StartView_GotFocus);

 

regards.

Developer
Nov 7, 2011 at 11:33 AM

Hi,

It would be helpful if you could provide us with a repro sample application that portrays this scenario, so we can help you troubleshoot your problem.

Thanks,

Agustin Adami
http://blogs.southworks.net/aadami


Nov 8, 2011 at 9:14 AM

Hi Agustin,
hi anyone,

thank you for your interest.

Unfortunately i am currently unable to size down the application in a certain time.
I will take charge of a small sample.

Irrespective of the an code-example, is the discripte behavior (see above) correct/expectable?

Is an additional action required to set the focus to the new view?

Is there a best practice to solve this issue?

 

Thanks

Developer
Nov 8, 2011 at 5:48 PM

Hi,

As far as I know Prism doesn't provide guidance about best practices to manage focus in controls.

Based on my understanding, you could try setting the Focusable Property of your Control to true, which would make your control react to focus. If this doesn't help, you could try the Focus Method, which allows you to set focus to an element.

I hope you find this handy.

Agustin Adami
http://blogs.southworks.net/aadami