Hide wpf popup when click on a Winform control - wpf

I have an ElementHost object in a WinForm dialog.
This elementhosts child is a Popup.
I want to hide or close the Popup when the user clicks anywhere. I can do it when the click happened in the Popup. How to close it when the user clicks outside the popup, on a WinForm control?

Did you try StaysOpen=false?

Related

How to open a nonmodal child dialog that gets focused again when parent is refocused

I work on an MDI application where all Forms are opened as separate tabs.
I would like to open a dialog (non-modal) from one tabbed form which then sticks with this form.
I would like to have the dialog hide when another tab (form) is navigated to. But as soon as I navigate back to the form which opened the dialog, the dialog should be still visible as well.
Do I have to do this by hand? If I just show the dialog form like
form.Show(this)
where "this" is the parent form, the dialog just goes to the background when navigating away and is not focused again when navigating to the parent.

How to show a WPF modal window over a WPF popup?

I have a WPF app where I make my screen dark and show the user a popup for him to fill in some data.
One of the controls hosted in that popup might raise a modal window asking the user to confirm some validation results, when that modal is raised it doesn't show because the popup takes precedence in the UI.
Is there a way to force the modal be shown over the popup?

Silverlight - Open dropdown only clicking on Toggle button

Can anybody tell me how I can open popup by clicking only on Toggle button. Usually, combobox opens popup when you click anywhere. In our project we need to open popup only when user clicks on Toggle button. It's kinda urgent.
One approach would be to create a custom control. This would give you more control over all the parts that make up your combobox. http://blogs.msdn.com/b/sburke/archive/2008/03/22/tutorial-writing-a-templated-silverlight-2-control.aspx

closing a silverlight window on button click

There are Ok and Cancel buttons in a silverlight window.
When clicking cancel button on that window how can I close the window?
If the SilverLight application is hosted in a WebBrowser then you can redirect the browser to another page:
HtmlPage.Window.Navigate(new Uri("../Login/Login.aspx", UriKind.Relative));
U can use next statement:
System.Windows.Browser.HtmlPage.Window.Invoke("close");

How to force control ignore any gui events in Silverlight

I have a simple page with canvas control.
Inside canvas I have some SL controls like buttons, textboxes etc.
Also I cover the controls by semi-transparent Image control. So, when I click on some button, the click message doesn't reach the button, because I click on Image.
Is there a way to say the Image that it must not handle any gui events ?
p.s I use SL4
You should add IsHitTestVisible="False" to your image.

Resources