Keyboard navigation between Panels
BitSmithy
1,751
Reputation points
I have such XAML:
<StackPanel TabFocusNavigation="Cycle"
XYFocusKeyboardNavigation="Enabled"
>
<StackPanel>
<TextBox x:Name="H"
AcceptsReturn="True" TextWrapping="Wrap"
></TextBox>
<StackPanel>
</StackPanel>
</StackPanel>
<StackPanel>
<TextBox x:Name="H1"
AcceptsReturn="True" TextWrapping="Wrap" Text="H1"></TextBox>
<StackPanel>
<TextBox x:Name="L1"
AcceptsReturn="True" TextWrapping="Wrap" Text="L1"></TextBox>
<TextBox x:Name="L2"
AcceptsReturn="True" TextWrapping="Wrap" Text="L2"></TextBox>
</StackPanel>
</StackPanel>
<StackPanel>
<TextBox AcceptsReturn="True" TextWrapping="Wrap" Text="H1"></TextBox>
<StackPanel>
<TextBox AcceptsReturn="True" TextWrapping="Wrap" Text="L1"></TextBox>
<TextBox AcceptsReturn="True" TextWrapping="Wrap" Text="L2"></TextBox>
</StackPanel>
</StackPanel>
</StackPanel>
And such code behind:
public sealed partial class MainPage : Page
{
const string NL = "\r\n";
public MainPage()
{
this.InitializeComponent();
H.Text = "Header L1\r\n" + "Header L2\r\n" + "Header L3";
H1.Text = "Header L1\r\n" + "Header L2\r\n" + "Header L3";
L1.Text = "L1\r\n" + "L2\r\n" + "L3";
L2.Text = "L1\r\n" + "L2\r\n" + "L3";
}
}
Now I want to nawigate using ArrowKeyUP and ArrowKeyDown. When I use ArrowKeyUP navigation flows OK. It flows line by line and next jumps to next TextBox. When I use ArrowKeyDown navigation doesnt flow. Cursor flows TextBox line by line but it doesnt jump between TextBoxes. Is it possible to fix it without hardcoding?