locked
resizing based on browser window size RRS feed

  • Question

  • This part if difficult for me.  I created a small webpage in blend. Then I try to load it up for a sample viewing.  The image is pushed up to the to left of the page and there is a bunch of whitespace.  The image is the primary background for the website.  How do I get the image and entire page to automatically resize based on who is viewing the page and the settings on their computer?  This would apply to both when an image is the background of my site and when it is not.  

    I tried using auto in the layout lettings that did not do the job.  

    Thank you for your help. 
    Monday, December 21, 2009 8:36 PM

All replies

  • Hi,

    If you wanted to auto size you website automaticaly to the size of the screen of the user, you just simply need to put "Auto" on the XAML code of your page.

    Here an exemple :

    The default document :

    <UserControl
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	x:Class="SilverlightApplication2.MainPage"
    	Width="640" Height="480">
    
    	<Grid x:Name="LayoutRoot" Background="Black"/>
    </UserControl>
    The auto resize document :

    <UserControl
    	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    	x:Class="SilverlightApplication2.MainPage"
    	Width="auto" Height="auto">
    
    	<Grid x:Name="LayoutRoot" Background="Black"/>
    </UserControl>


    But the problem is, all of your image or content you add to this page gonna be resized too... So you need to specify wich one need to be "locked" and wich one need to be auto sized.

    You can do this in the properties menu of your element, and change the value "!your size!(auto)" to "!your size".

    Normally this can help you to lock every components on a defined size.
    And if you search a litle bit, you can find in the properties menu, an option where you can tell the minimum size of the object, and the maximum size... The max size by default is on Infinity.

    Good luck ;)
    Tell me if it's help.

    Ickyaxe
    Wednesday, December 23, 2009 4:13 PM