0

I have an ItemsControl binding to a collection in the ViewModel. As a result of user input, a new item gets added to the collection and this gets displayed on the View.

The item is also a View-ViewModel pair, the View contains a TextBox that I would like to receive focus immediately after being added to the collection.

How do I set the focus to a TextBox without referencing the View from within the ViewModel? Are attached properties the way to go here?

jidl
  • 195
  • 1
  • 2
  • 19

1 Answers1

1

well you can do this by creating a behaviour..

have a look here to get an idea of behaviours controlling focus

Community
  • 1
  • 1
Muds
  • 4,006
  • 5
  • 31
  • 53