Skip to main content

Microsoft Silverlight

Answered Question Silverlight 2 #top of page , page switchRSS Feed

(0)

BigWyo
BigWyo

Member

Member

1 points

5 Posts

Silverlight 2 #top of page , page switch

Hola,

How does one switch to the top of a new page in Silverlight? If Page1 has content 1200px(Height) and the switch button is at the bottom of the page;  when I switch to Page2 800px(Height) I am still located at the bottom of the browser window when Page 2 loads and can only see half of Page 2's content.  I would like to switch to the top of the broswer window during a page switch. 

Any help would be greatly appreciated. 

Thanks   

HarshBardhan
HarshBar...

Star

Star

9908 points

1,719 Posts

Answered Question

Re: Silverlight 2 #top of page , page switch

hi,

You Can call a Javascript method from silverlight which will navigate you to top of the Page.

Mark as answer if this post answered your question.

Harsh Bardhan

BigWyo
BigWyo

Member

Member

1 points

5 Posts

Answered Question

Re: Silverlight 2 #top of page , page switch

 Excellent idea HarshBardhan,

 

This is one solution to have your web browser go to the top of a page when a new Silverlight page is loaded.

 The code I used is simple and goes as follows:

 

C# nextpage.xaml.cs
 

using System.Windows.Broswer;

 

public nextpage()

{
            HtmlPage.Window.CreateInstance("topOfPage");   // "topOfPage" is your javascript function name 

}

 

.aspx file where the silverlight .xap file is being used.

<script type="text/javascript" >
function topOfPage() {
    window.scrollTo(0,0)
}
</script>
 

Thanks for the ideas. 

HarshBardhan
HarshBar...

Star

Star

9908 points

1,719 Posts

Re: Silverlight 2 #top of page , page switch

Hi,

I think this is the only idea by which we can get top of the Browser..

 

Mark as answer if this post answered your question.

Harsh Bardhan
  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities