Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. WPF
  4. event

event

Scheduled Pinned Locked Moved WPF
csharpwpfhelptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    lankaudaranga
    wrote on last edited by
    #1

    how to create keypress event for textbox control(wpf application) please help. thank you.

    P 1 Reply Last reply
    0
    • L lankaudaranga

      how to create keypress event for textbox control(wpf application) please help. thank you.

      P Offline
      P Offline
      Pete OHanlon
      wrote on last edited by
      #2

      In your textbox declaration, add the following handler:

      PreviewKeyDown="KeyDownHandler"

      In the codebehind, you will add the code:

      private void KeyDownHandler(object sender, KeyEventArgs e)
      {
      //
      }

      WPF allows you to preview commands, so there is no need to use a keypress to validate the item because you can cancel it here by setting e.Handled = true; in response to your test.

      Deja View - the feeling that you've seen this post before.

      My blog | My articles

      S 1 Reply Last reply
      0
      • P Pete OHanlon

        In your textbox declaration, add the following handler:

        PreviewKeyDown="KeyDownHandler"

        In the codebehind, you will add the code:

        private void KeyDownHandler(object sender, KeyEventArgs e)
        {
        //
        }

        WPF allows you to preview commands, so there is no need to use a keypress to validate the item because you can cancel it here by setting e.Handled = true; in response to your test.

        Deja View - the feeling that you've seen this post before.

        My blog | My articles

        S Offline
        S Offline
        Soniya Philip
        wrote on last edited by
        #3

        Nice comment. I use this codes for my program. I think it is difficult for choosing in a program. Best essay writing service

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups