Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9192273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T20:52:57+00:00 2026-06-17T20:52:57+00:00

I m working on C# and XAML for metro applications. I have a textbox

  • 0

I m working on C# and XAML for metro applications. I have a textbox and I want that once enter is pressed in that textbox a new textbox appears. But instead of just one textbox, I m getting two textboxes. I did debugging also n realized that its triggerd twice. Not able to figure out why it is triggerd twice.
here is some code of my application

private void TextBox_KeyDown_1(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
    {
        if (e.Key == Windows.System.VirtualKey.Enter)
        {
          //code for producing textbox
        }

    }

when i m debugging, once the above block is executed, it going to LayoutAwarePage.cs
and the control is sent to ths code snippet

private void CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender,
        AcceleratorKeyEventArgs args)
    {
        var virtualKey = args.VirtualKey;

       if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||
            args.EventType == CoreAcceleratorKeyEventType.KeyDown) &&
            (virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right ||
            (int)virtualKey == 166 || (int)virtualKey == 167))
        {
            var coreWindow = Window.Current.CoreWindow;
            var downState = CoreVirtualKeyStates.Down;
            bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;
            bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;
            bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;
            bool noModifiers = !menuKey && !controlKey && !shiftKey;
            bool onlyAlt = menuKey && !controlKey && !shiftKey;

            if (((int)virtualKey == 166 && noModifiers) ||
                (virtualKey == VirtualKey.Left && onlyAlt))
            {
                // When the previous key or Alt+Left are pressed navigate back
                args.Handled = true;
                this.GoBack(this, new RoutedEventArgs());
            }
            else if (((int)virtualKey == 167 && noModifiers) ||
                (virtualKey == VirtualKey.Right && onlyAlt))
            {
                // When the next key or Alt+Right are pressed navigate forward
                args.Handled = true;
                this.GoForward(this, new RoutedEventArgs());
            }
        }
    }  

once ths code block is done, the control is sent back to the function TextBox_KeyDown_1. I m nt able to understand why on the first place control is sent to layoutawarepage.cs . This code was generated when i added SplitPage in my project.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T20:52:58+00:00Added an answer on June 17, 2026 at 8:52 pm

    I had the same problem, and found the following article on MSDN which says MS is aware of the bug and has filed it in their internal database. The suggestion of handling KeyUp instead of KeyDown worked for my situation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a XAML MenuItem DataBound ItemsSource that is working fine however there is
I am working on a Metro App using C++ and XAML. I want to
I have the following working XAML code that basically binds a couple of properties
I'm working with Silverlight 4, C# and XAML. I have an external control that
I'm working with XAML in Windows 8 Metro. I have a grid with multiple
I am working on a Windows 8 Metro Newsreader-App (with C# and XAML). I
I am working on a Metro Style App. In Metro, you can mix XAML
I am working with a TabControl in XAML, however I only want certain TabItems
I've got style resources in WPF working so that in my App.xaml I can
I'm working on a tool that renders pieces of XAML to images.The XAML is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.