Blue Theme Orange Theme Green Theme Red Theme
 
Team Foundation Server Hosting
Home | Forums | Videos | Photos | Blogs | Beginners | Advertise with Us
 | Consulting  
Submit an Article Submit a Blog 
Search :       Advanced Search »
Home » Blogs Home » Blog Detail

Window Resizing

 by Dinesh Beniwal on Oct 06, 2009

Although absolute positioning of objects by using a Canvas is useful in some scenarios.
Comments: 0 Views: 6976 Printable Version 

Although absolute positioning of objects by using a Canvas is useful in some scenarios, it is typically a bad strategy in a browser window that will vary in size. Absolute positioning does not allow your objects to reflow on the page in response to browser window resizing; instead, objects remain positioned at their specified pixel positions.

StackPanel and Grid allow for reflow of content. The Grid object is the root element used by the Visual Studio Silverlight template. Although the Grid is more complex to use than other Panel objects, it enables reflow of content and is flexible enough for you to create a variety of object layouts.

To get the best window resizing behavior (in addition to using Panel objects to position child objects), it is generally best to leave the DOM width and height properties at 100% and exclude any width or height declarations from the root element of your XAML file or the layout root element. For example, in the following XAML, neither the root element nor the layout element has a width or height defined.

XAML

<UserControl x:Name="RootElement" x:Class="WindowResizingSample.Page"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Grid x:Name="LayoutRoot" Background="White">

    </Grid>
</UserControl>

Comment Request!
Thank you for reading this post. Please post your feedback, question, or comments about this post Here.
 
What do you say about this post? Post a comment here
*Title:
*Comment:
 
Comments not available.
Team Foundation Server Hosting
Become a Sponsor

 Blogger's Profile
Age: Not Available
Location:
Title: Tech Lead
Joined: Nov 04, 2008
Education: Masters Degree
 More Blogs from this Blogger
Initializing Compound Values
Deferred Query Evaluation
Extension Methods
Lambda Expressions and Expression Trees
Getting Started with Standard Query Operators
.NET Language-Integrated Query
Window Resizing
The Layout System in Silverlight
The Silverlight Plug-in Position and Dimensions
Colors and Brushes for Text Foreground
View all »
 Latest Blogs
Initializing Compound Values
Deferred Query Evaluation
Extension Methods
Lambda Expressions and Expression Trees
Getting Started with Standard Query Operators
.NET Language-Integrated Query
Window Resizing
The Layout System in Silverlight
The Silverlight Plug-in Position and Dimensions
Colors and Brushes for Text Foreground
View all »
 Latest Jobs
More ... 
 Latest Interview Questions
More ... 
Team Foundation Server Hosting
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.