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. how to close wpf window if i click outside the wpf window

how to close wpf window if i click outside the wpf window

Scheduled Pinned Locked Moved WPF
csharpwpftutorial
4 Posts 4 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.
  • S Offline
    S Offline
    sumitk cadc
    wrote on last edited by
    #1

    hi all, i want to close my wpf window when i click mouse out side the wpf window.

    S P L 3 Replies Last reply
    0
    • S sumitk cadc

      hi all, i want to close my wpf window when i click mouse out side the wpf window.

      S Offline
      S Offline
      Satish Pai
      wrote on last edited by
      #2

      Hi, Does the Window has a MDI form or such ?

      1 Reply Last reply
      0
      • S sumitk cadc

        hi all, i want to close my wpf window when i click mouse out side the wpf window.

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

        If this is a window contained inside another WPF window, a good way to do this is have the window you want closing actually be a Popup. Set StaysOpen = false on the Popup, and it will close when you click outside the popup area.

        *pre-emptive celebratory nipple tassle jiggle* - Sean Ewington

        "Mind bleach! Send me mind bleach!" - Nagy Vilmos

        CodeStash - Online Snippet Management | My blog | MoXAML PowerToys | Mole 2010 - debugging made easier

        1 Reply Last reply
        0
        • S sumitk cadc

          hi all, i want to close my wpf window when i click mouse out side the wpf window.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Put a Close() method in the Deactivated event of the window.

          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