1
votes

I'm creating a Visual Studio project as WPF application. but presently I am creating only Windows forms inside that project. I have plans to convert them to WPF in future, that's why I created the project as WPF application.

I set one of my windows forms as Startup form in App.xaml. The forms are loading and everything works fine except the tab navigation. The first control gets focused on the startup, but when I press Tab key the focus is not moving to the next control.

This is my App.xaml.cs file

namespace WpfTest
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
public partial class App : Application
{
    private void Application_Startup(object sender, StartupEventArgs e)
    {
        frmStudent frm = new frmStudent();
        frm.Show();

    }
}
}

This is my App.xaml file

<Application x:Class="WpfTest.App"
         xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
         xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
         xmlns:local="clr-namespace:WpfTest"
         Startup="Application_Startup">
<Application.Resources>

</Application.Resources>
</Application>

I have created a sample project in Visual Studio 2015 to illustrate the problem and uploaded to Google Drive. You can download it from here. I am a newbie in WPF.

2
Have you set the TabIndex properties? - Steve
Hi there. For all questions, we ask that the relevant code is added to the question itself, rather than being added to a file locker. Would you be able to show the relevant config or code, trimmed down to the smallest possible example, in the question itself? A block formatting tool is available. - halfer
@darren-young : I set the TabIndex for all Textboxes and set TabStop=true - Hamzathussadique Mankarathodi

2 Answers

0
votes

Check that if you have set "tab index" for the components

0
votes

Atlast i found Solution. I used "ShowDialog" instead of "Show" method in App.xaml.cs file. I don't know why, It worked.

namespace WpfTest
{
  /// <summary>
  /// Interaction logic for App.xaml
  /// </summary>
  public partial class App : Application
  {
    private void Application_Startup(object sender, StartupEventArgs e)
    {
       frmStudent frm = new frmStudent();
       frm.ShowDialog();

    }
  }
}