what you are trying to accomplish is view related code (in my opinion). The mvvm guidiance or pattern use (or at least my understanding of it) state that you want to use behaviors or attached properties for that. Means extending xaml functionality to plugin view related behaviors...
I found a stackoverflow question that relates to your topic. Check out if this might help... or try to derive from that solution...
Link:
Initial Focus and Select All behavior
HTH