I have several textboxes on my view. One of them needs to get focus. Which one exactly is defined in the data model. Currently I call the Focus method right after binding is done. I get false as a result which means the focus cannot be set. Question is
- what is right time for doing this?
- how do I know this moment being in the view model without knowing about the view anything?
The right answer is to schedule setting the focus via Dispatcher.BeginInvoke. It means the view model has to have a reference to the Dispatcher object which is somewhat tricky to do but worth the effort.