How do I disable the exit button on a Silverlight 3 Child Window?
Asked Answered
M

4

9

I mean the small exit/cancel button marked with an X in the top right hand corner. I want to implement a Logon dialog box that accepts a username/password so obviously I don't want the user to be able to dismiss the modal pop up. If it is not possible to remove or disable the button then is there some way I can intercept the closing event and stop it closing?

Malaspina answered 6/4, 2009 at 14:12 Comment(0)
E
29

You can use the HasCloseButton property of the ChildWindow to hide the close button.

Please let me know if this helps.

Ezequiel Jadib

Etiolate answered 10/7, 2009 at 17:17 Comment(1)
I'd like to note that this property is not listed in the property view of the design view. You have to go in to your code and type it in (like Me.HasCloseButton = False)Fiedler
S
2

The code below prevents a ChildWindow from ever closing, effectively disabling the X button. Modify to suit your business logic.

protected override void OnClosing(System.ComponentModel.CancelEventArgs e)
{
    base.OnClosing(e);
    e.Cancel = true;
}
Stadia answered 7/4, 2009 at 21:54 Comment(0)
S
1

Select child window and Press F4. It will show the property window. Then goto HasCloseButton property and uncheck the checkbox.

Enjoy

Samples answered 7/6, 2011 at 12:58 Comment(0)
P
1
HasCloseButton="False" .. 

This property used to hide the 'X' button In ChildWindow

Phalanger answered 15/5, 2012 at 7:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.