closing a silverlight window on button click - silverlight

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");

Related

How to avoid blocking new window popup in AngularJS

I've an issue on opening new page window in my Angular JS project if popup is being blocked.
Do you have any solution on bypass popup/new window blocking in IE > 8
Note; It's not a button click event to open new window.
If you are referring to the window popup using window.open() you can't specially if the user has blocked popup's from their browser that popups blocked icon at the rightmost part of the url bar or in the browser settings then you can't do anything about it.

Hide wpf popup when click on a Winform control

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?

How to Open modal window/dialog in XBAP Application?

In WPF, if i want to open a modal/response window then i write code like
Window1 _windowObj1 = new Window1();
_windowObj1.Owner = mainWindowObject;
_window1Obj.ShowDialog();
How to do the same in XBAP. I tried it, but the window is opened independently from the parent page as i cant assign it as a Owner of modal window.
How to Open modal window/dialog in XBAP Application?
I'm not really experienced with XBAP apps, but I believe you should try displaying "popups" in an adorner layer. This has the same effect (you can't access the rest of the application), but doesn't actually open another window according to windows. Google for "wpf adorner dialog" and you should get some results.
Here are some links:
How do I make modal dialog for a Page in my WPF-application?
http://www.codeproject.com/KB/silverlight/slmodal.aspx
http://www.codeproject.com/KB/WPF/wpfmodaldialog.aspx
You did implement Window of WPF? If so, it will not work in XBAP. Please host your UserControl to Windows.Form, then you can open modal window/dialog in XBAP Application

open new silverlight window when button click

I created a Silverlight window and I want it to appear when I press a button. How can
I do that? It doesn't has a "show" method...
To open a new address in a new window use:-
HtmlPage.Window.Navigate(new Uri("the address here"), "_blank");
see:
Silverlight Simplified MVVM Modal Popup
http://www.codeproject.com/KB/silverlight/MVVMPopUp.aspx
If you want to browse to a new silverlight application hosted in another html page you should use the NavigationService class to accomplish that.
If you on the other hand want to display another view defined in your silverlight application then you should do something like this Silverlight 3 Navigation.

how to navigate on the button click

I am developing a SilverLight Project using SilverLight BusinessApplication Template RIA services.I want to navigate from one xaml page to another xaml page on the click of a Button that is placed on the first Xaml Page. i don't want to use Hyperlink button.
Any Suggestions...
Duplicate here:
Put this inside the event handler of the button:
this.NavigationService.Navigate(new Uri("nextpage.xaml", UriKind.Relative));

Resources