Reuse WPF window in PS

Welcome Forums General PowerShell Q&A Reuse WPF window in PS

This topic contains 1 reply, has 2 voices, and was last updated by

 
Keymaster
1 year, 10 months ago.

  • Author
    Posts
  • #62668

    Participant
    Points: 0
    Rank: Member

    Hi!
    I have a main window that has a button. When the button is click, it will open another wpf window called w2. If I close w2, the next time I click the button I get an error message basically saying that the window was closed and cannot be reused.

    How can I make sure that a new wpf window is created everytime the button is clicked?
    Note: I am using visual studio to create the window.

    Thanks

  • #62755

    Keymaster
    Points: 1,673
    Helping HandTeam Member
    Rank: Community Hero

    Without seeing code (and please use a Gist versus posting a huge chunk), it's hard to tell. But essnetially you must create a brand new instance from scratch, rather than reusing a prior reference.

The topic ‘Reuse WPF window in PS’ is closed to new replies.