I have a MVVM application and I want to keep track of the focused element in my ViewModel.
I would like to set ViewModel property when a TextBox is focused. I would like to have something like this
<TextBox Text="{Binding P1}">
<TextBox.Style>
<Style TargetType="{x:Type TextBox}">
<Style.Triggers>
<Trigger Property="IsFocused" Value="True">
<Setter Property="{Binding P1Selected}" Value="True"/>
</Trigger>
</Style.Triggers>
</Style>
</TextBox.Style>
</TextBox>
where P1 and P1Selected are viewModel properties. Of course this code does not work. I wrote it just to give the idea..