Click here to Skip to main content
13,141,637 members (55,535 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi all at Code Project,
Is it possible to write code to automatically "Restore Down" a hosting page to fit the dimensions of the hosted application. From the Microsoft website there is the following code (VB) I only want to set the height and width of the host page but as I am a beginner I don't know exactly what I need and how to apply it into my code.
Can anybody help.
Kind Regards

Public Event Resized As EventHandler

Private WithEvents rootPage As Page = New Page()
Private WithEvents htmlContent As Content
Private Sub Application_Startup(ByVal o As Object, ByVal e As StartupEventArgs) Handles Me.Startup
Me.RootVisual = rootPage
htmlContent = Me.Host.Content
End Sub

Private Sub ToggleFullScreen(ByVal sender As Object, _
ByVal e As MouseButtonEventArgs) Handles rootPage.MouseLeftButtonDown
Me.Host.Content.IsFullScreen = Not Me.Host.Content.IsFullScreen
End Sub

Private Sub DisplaySizeInformation( _
ByVal sender As Object, ByVal e As EventArgs) _
Handles htmlContent.FullScreenChanged, htmlContent.Resized

Dim message As String = String.Format( _
"ActualWidth={0}, ActualHeight={1}", _
Me.Host.Content.ActualWidth, _

Dim t As New TextBlock()
t.Text = message

End Sub
Posted 23-Nov-12 23:17pm
Updated 26-Nov-12 10:47am
willrob68 13-Feb-13 17:38pm
Hi Christian, does the link that you have supplied refer to the content inside the silverlight host page i.e the application in the content area automatically resizes when the silverlight host page is resized by some other means? If that's the case that is not what I am looking for. I want to automatically resize the host page to fit the application dimensions in the content area i.e as if you had just opened the page and you manually restore down the page to fit the application dimensions. I want to get the web page app looking like more like an OOB app when opened.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

willrob68 8-Dec-12 11:01am
Hi Christian, thanks for your response, I have looked at the answer given to me from the Microsoft Forum. If you look closely to the question I have submitted you'll see that I have actually copied the the code from the Microsoft web site (please see above) but being a "newbie" I'm not sure which part of the code applies to me, Where it goes and what I need to do to make it work. Can you help? My application dimensions are only 754 x 624 in pixel area and all I want to do is reduce the browser page to fit these dimensions.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web02 | 2.8.170915.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100