You must Sign In to post a response.
  • Category: WPF

    How to Check the Windows already Open or Not in WPF MVVM ?

    Dear Team ,

    I have Menu Bar Like Transaction when i am click ,open the Create transaction window should be open .
    again i am going to try to open the Create Transaction window .

    how to give the warning Message like "Already create Transaction Window opened"

    how to check the window currently open or Not ?
    if i am click the opened window , give some warning message and show the old opened window.?
  • #769782
    Lets say your window is TransactionWindow.

    Now, fetch all the opened windows collection,
    WindowsCollection windows=Application.Current.Windows;

    Iterate through this collection and compare with your TranscationWindow.
    foreach(Window window in windows)
    {
    if(window.Equals(TransactionWindow))
    MessageBox.Show("Transaction Window is already Open");
    }



    Hope, this solves ur issue.

  • #769783
    I think you can achieve same thing with below code as like

    var oTranscationWindow;

    var URL=<<TranscationWindow URL>>;

    if(oTranscationWindow!= undefined)
    {
    if(oTranscationWindow.closed)
    oTranscationWindow = window.open(URL,"TranscationWindow","top=100px,left=50px,width=200px,height=100px");
    else
    alert("Already create Transaction Window opened");
    }
    else
    oApptWindow = window.open(URL,"TranscationWindow","top=100px,left=50px,width=200px,height=100px");


    Hope the above code suits for your requirement.

    Thanks!
    B.Ramana Reddy


  • Sign In to post your comments