locked
Modal Window RRS feed

  • Question

  • Hi,

    Is there a way to create a Modal Window were you cannot continue on until OK or Cancel is pressed?  To clarify, I don't want to user to do anything.  No selecting another screen from the menu or selection an existing tab.

    Thanks,

    Dave


    EDIT: When I mean Modal Window I am referring to the Modal Window Group control on a screen.
    • Edited by Dave Vorgang Wednesday, January 4, 2012 3:47 PM clarification
    Tuesday, January 3, 2012 8:26 PM

Answers

  • There's nothing built-in that will allow you to do this.

    What you can do is create a new instance of the ChildWindow class (found in the System.Windows.Control namespace of the System.Windows.Controls assembly) can call it's Show method. This will overlay the entire application, but it does not have buttons; it's just a child window. You can:

    • apply a style to the control to add the buttons
    • subclass ChildWindow and add buttons in the default style
    • Add child elements through code starting with the ChildWindow's Content property.

    Justin Anderson, LightSwitch Development Team
    Wednesday, January 4, 2012 7:14 AM
    Moderator

All replies

  • There's nothing built-in that will allow you to do this.

    What you can do is create a new instance of the ChildWindow class (found in the System.Windows.Control namespace of the System.Windows.Controls assembly) can call it's Show method. This will overlay the entire application, but it does not have buttons; it's just a child window. You can:

    • apply a style to the control to add the buttons
    • subclass ChildWindow and add buttons in the default style
    • Add child elements through code starting with the ChildWindow's Content property.

    Justin Anderson, LightSwitch Development Team
    Wednesday, January 4, 2012 7:14 AM
    Moderator
  • That does seem like a lot of work. 

    I would have thought that this would be a common scenario since all Modal screens work this way in a windows application.  Would this be something that could be addressed by creating another type of Modal Window Group control?

    Thanks,

    Dave

    Wednesday, January 4, 2012 3:40 PM
  • Hey Dave,

    Basically, you want to disable the user from closing the Modal Window until a custom button is closed, yes?

    I thought there was a way to disable the Modal Window close - even if the "X" was still visible, the Modal window won't close.

    This concept allows us to use a series of MWs to build Wizards.


    Garth Henderson - Vanguard Business Technology
    Wednesday, January 4, 2012 11:38 PM
  • He said he doesn't even want the user to be able to select another screen or anything in the menu, so the modal window needs to be application wide, not specific to the screen.
    Justin Anderson, LightSwitch Development Team
    Wednesday, January 4, 2012 11:40 PM
    Moderator
  • Would this be something that could be addressed by creating another type of Modal Window Group control?


    Yes, by using the second option that I mentioned.
    Justin Anderson, LightSwitch Development Team
    Wednesday, January 4, 2012 11:41 PM
    Moderator
  • Hi Garth,

    No, I want the user to not be able to go to another screen in the program until the user closes out the modal window (it's really just a group control).  Just like what occurs on a standard modal form in a windows application.

    Does that clarify it?

    Thanks,

    Dave

    Wednesday, January 4, 2012 11:43 PM
  • Would this be something that could be addressed by creating another type of Modal Window Group control?


    Yes, by using the second option that I mentioned.
    Justin Anderson, LightSwitch Development Team


    I'm assuming you mean to subclass the child window.  I don't know how to do that.  Is this part of the LS Extensibility Toolkit?  Would one create a new LS Control?

    Thanks

    Thursday, January 5, 2012 12:03 AM