locked
How to open a viewwindow on a button click event of another viewwindow in wpf using mvvm. RRS feed

  • Question

  • Hi,

    How to open a viewwindow on a button click event of another viewwindow in wpf using mvvm.

    Thanks

    Wednesday, March 13, 2013 12:24 PM

All replies

  • Hi RahulKrishnan,

    You can use a command of ICommand for the first ViewWindow's button click and in that action of that command, create or open a new Window as like your wish.

    Another way: 

    Make sure the DataContext would be same for both the window, so that you can use the properties in it. Have Command of ICommand for the button click and handle the Visibility of second ViewWindow with the same property for any other.


    sankar

    Thursday, March 14, 2013 4:40 AM
  • Couple of other ideas...

    var view2 = new view2();
    view2.Show();

    Or fire an event...

    WindowOpenerOpen(new view2);

    etc.

     


    JP Cowboy Coders Unite!

    Thursday, March 14, 2013 5:35 AM
  • Hi Sankaran,

    Can I have some sample code for your explanation please.

    Thanks.

    Thursday, March 14, 2013 8:52 AM