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
  1. Home
  2. General Programming
  3. WPF
  4. Login when user press enter in passwordtextbox

Login when user press enter in passwordtextbox

Scheduled Pinned Locked Moved WPF
wpfcsharpregexarchitecturetutorial
4 Posts 2 Posters 2 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.
  • R Offline
    R Offline
    Ravi Mori
    wrote on last edited by
    #1

    hi friends.. Currently i am developing wpf application using mvvm pattern. I have one textbox in which user enters his username and another passwordbox in which he enters password. Now what i want, after entering password when user press enter then LoginCommand which is binded with LoginButton will be fire.. This thing will be done if i wrote keypress event on codebehind..but i am using mvvm pattern so how to handle this in viewmodel?? Thanks a lot..

    P 1 Reply Last reply
    0
    • R Ravi Mori

      hi friends.. Currently i am developing wpf application using mvvm pattern. I have one textbox in which user enters his username and another passwordbox in which he enters password. Now what i want, after entering password when user press enter then LoginCommand which is binded with LoginButton will be fire.. This thing will be done if i wrote keypress event on codebehind..but i am using mvvm pattern so how to handle this in viewmodel?? Thanks a lot..

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

      First of all, you don't have to get completely hung up on the View having no code behind it, in MVVM - it's a convention, not a hard and fast rule. Secondly, you should set your login button to be the default button using IsDefault="true" in the button attributes; this will trigger the Command behind the button on an Enter press.

      "WPF has many lovers. It's a veritable porn star!" - Josh Smith

      As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

      My blog | My articles | MoXAML PowerToys | Onyx

      R 1 Reply Last reply
      0
      • P Pete OHanlon

        First of all, you don't have to get completely hung up on the View having no code behind it, in MVVM - it's a convention, not a hard and fast rule. Secondly, you should set your login button to be the default button using IsDefault="true" in the button attributes; this will trigger the Command behind the button on an Enter press.

        "WPF has many lovers. It's a veritable porn star!" - Josh Smith

        As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

        My blog | My articles | MoXAML PowerToys | Onyx

        R Offline
        R Offline
        Ravi Mori
        wrote on last edited by
        #3

        Thanks a lot.. IsDefault=true works for me..

        P 1 Reply Last reply
        0
        • R Ravi Mori

          Thanks a lot.. IsDefault=true works for me..

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

          You're welcome. :-D

          "WPF has many lovers. It's a veritable porn star!" - Josh Smith

          As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.

          My blog | My articles | MoXAML PowerToys | Onyx

          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