views:

814

answers:

4

i have a silverlight window, when a button pressed i want to open it on a new tab\window, how can i do it?

+1  A: 

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");
Charlie Somerville
but its not google or something like that, its a window i created, so what's the URL i need to put there?
Well change the google.com URL to your own URL...
Charlie Somerville
but i don't have URL! that's the point, it's just a window that i created, so it dos'nt has URL, or does it?
i wrote HtmlPage.Window.Navigate(new Uri("http://localhost:52878/DoNationFinalTestPage.aspx#/jjj"), "Organiztrion_info_from_toolTip"); is the window that i built, but it opens the application again in a new window and not the "Organiztrion_info_from_toolTip" window
A: 

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.

Jehof
and where is the window fit in?System.Windows.Browser.HtmlPage.Document.DocumentUri.myWindow?
@aharont: I don´t understand what mean?
Jehof
ok, if my window is called orgTip, how can i open it with the line you wrote?
and it's not hyperLink, its a regular button...
+1  A: 

Taking your question literally the answer is:-

HtmlPage.Window.Navigate(HtmlPage.Document.DocumentUri, "_blank"); 
AnthonyWJones
but there is no mention to the window that need to be open.let say the name of my window is app, how does it fit un what you wrote?
@aharont: IF the window name is "app" then change "_blank" to "app"
AnthonyWJones
LIKE THIS: HtmlPage.Window.Navigat(HtmlPage.Document.DocumentUri, "OrganiztrionInfoFromToolTip"); ?it open me the program again, not my window...
i wrote HtmlPage.Window.Navigate(new Uri("http://localhost:52878/DoNationFinalTestPage.aspx#/jjj"), "Organiztrion_info_from_toolTip"); is the window that i built, but it opens the application again in a new window and not the "Organiztrion_info_from_toolTip" window
A: 

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.

SmartyP
i wrote HtmlPage.Window.Navigate(new Uri("http://localhost:52878/DoNationFinalTestPage.aspx#/jjj"), "Organiztrion_info_from_toolTip"); is the window that i built, but it opens the application again in a new window and not the "Organiztrion_info_from_toolTip" window