aharon
aharon

Reputation: 7623

Open a silverlight window in a new tab

I have a silverlight window, and when a button is pressed, I want to open it on a new tab\window. How can I do it?

Upvotes: 3

Views: 17235

Answers (6)

Zelxin
Zelxin

Reputation: 23

Rather than using the URI like people here are suggesting you should just create an object of your page and pass it to the navigate method.

Dim yournewpage as new OrganiztrionInfoFromToolTip()
HtmlPage.Window.Navigate(yournewpage, "_blank")

Upvotes: 1

Manoj Savalia
Manoj Savalia

Reputation: 1402

Also try this in .aspx Page

<head id="Head1" runat="server">
    <title>Your Applicateion</title>
    <script type="text/javascript">
        var windowClose = window.close;
        window.close = function () {
            window.open("", "_self");
            windowClose();
        }
        function OpenWindow() {
            window.opener = 'x';
            window.close();            
            window.open('Default.html', '_blank', 'status=no,toolbar=no,location=no,menubar=no,directories=no,resizable=no,scrollbars=no,height=' + screen.availHeight + ',width=' + screen.availWidth + ',top=0,left=0');
            return false;
        }
    </script>
</head>
<body onload="OpenWindow();">
    <form id="form1" runat="server">
    </form>
</body>

Upvotes: 0

SmartyP
SmartyP

Reputation: 1359

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.

Upvotes: -3

AnthonyWJones
AnthonyWJones

Reputation: 189437

Taking your question literally the answer is:-

HtmlPage.Window.Navigate(HtmlPage.Document.DocumentUri, "_blank"); 

Upvotes: 7

Jehof
Jehof

Reputation: 35544

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.

Upvotes: 0

user47322
user47322

Reputation:

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

Upvotes: 14

Related Questions