i have a silverlight window, when a button pressed i want to open it on a new tab\window, how can i do it?
The HtmlPage.Window.Navigate()
method has an overload which allows you to specify which frame to load the new page in. _blank
is used for new window/tab.
HtmlPage.Window.Navigate(new Uri("http://google.com"), "_blank");
You can use a HyperlinkButton for this.
<HyperlinkButton NavigateUri="http://www.silverlight.net" TargetName="_blank" Content="HyperlinkButton"/>
When you specify "_blank" as TargetName. A new tab or window is opened and the specified uri gets opened. Also other values for TargetName are valid. See here more.
Edit:
To open the same Silverlight application in a new tab you can use the System.Windows.Browser.HtmlPage.Document.DocumentUri as NavigationUri of the HyperlinkButton.
Taking your question literally the answer is:-
HtmlPage.Window.Navigate(HtmlPage.Document.DocumentUri, "_blank");
The only thing you can open 'in a new tab' is a web page. If you want to open a different Silverlight application in a new tab, then it will need to be hosted in a webpage, and you will need to use HtmlPage.Window.Navigate() to open that page. You cannot just open a new tab and have it somehow contain something embedded in your application - that is not how webbrowsers work.