I have a window with 3 textboxes and labels with following properties:
<Label x:Name="label" Content="_Label" Target="{Binding ElementName=textBox}"/>
<Label x:Name="label1" Content="Label"/>
<Label x:Name="label2" Content="_Label" Target="{Binding ElementName=textBox2}"/>
You can see that "label" and "label2" have the same ALT + L key but different Target property. When I focus textBox middle and I press ALT + L I need that textBox2 is focues (like in MFC). I can't use code behide because I was made about 200 windows. Thanks a lot!
I think if you really need with out code behind
or ViewModel
you can do it by adding the same short cut to Label1
like below,
<Label x:Name="label" Grid.Row="0" Content="_Label" Target="{Binding ElementName=textBox}"/>
<Label x:Name="label1" Grid.Row="1" Content="_Label" Target="{Binding ElementName=textBox1}"/>
<Label x:Name="label2" Grid.Row="2" Content="_Label" Target="{Binding ElementName=textBox2}"/>
<TextBox x:Name="textBox" Grid.Column="1" Grid.Row="0"/>
<TextBox x:Name="textBox1" Grid.Column="1" Grid.Row="1"/>
<TextBox x:Name="textBox2" Grid.Column="1" Grid.Row="2"/>
If you can make a ViewModel then InputBinding
with KeyBinding
can make it work.