Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Silverlight
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
Will.
 
'Declaration
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, _
Me.Host.Content.ActualHeight)
 
rootPage.LayoutRoot.Children.Clear()
Dim t As New TextBlock()
t.Text = message
rootPage.LayoutRoot.Children.Add(t)
 
End Sub
Posted 23-Nov-12 23:17pm
Edited 26-Nov-12 10:47am
v2
Comments
willrob68 at 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
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
willrob68 at 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
0 OriginalGriff 322
1 Nirav Prabtani 268
2 _Amy 170
3 Mika Wendelius 165
4 Richard Deeming 155
0 Nirav Prabtani 265
1 OriginalGriff 177
2 _Amy 170
3 Mehdi Gholam 105
4 Maciej Los 90


Advertise | Privacy | Mobile
Web04 | 2.8.140721.1 | Last Updated 7 Dec 2012
Copyright © CodeProject, 1999-2014
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