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

The Layout System in Silverlight

 by Dinesh Beniwal on Oct 06, 2009

The term layout describes the process of sizing and positioning objects in your Silverlight-based application.
Comments: 0 Views: 7619 Printable Version 

The term layout describes the process of sizing and positioning objects in your Silverlight-based application. To position visual objects, you must put them in a Panel or other container object. The parent Panel has defined layout behavior that determines how the members of a Panel element's Children collection are drawn onscreen. This is an intensive process, and the larger the Children collection, the greater the number of calculations made. Complexity can also be introduced based upon the layout behavior defined by the Panel element that owns the collection. A relatively simple layout such as Canvas can yield excellent performance when a more complex Panel such as Grid is not required.

Each time a child UIElement changes its position, it has the potential to trigger a new pass by the layout system. It's important to understand the events that can invoke the layout system, because unnecessary invocation can lead to poor application performance.

At its simplest, layout is a recursive system that leads to an element being sized, positioned, and drawn onscreen. The layout system completes two passes for each member of the Children collection, first a Measure pass and then an Arrange pass. The Measure pass is where the desired size of each child element is determined. The Arrange pass is where each child element's size and position is finalized.

Note: When referring to the layout of an element, it is more precise to refer to the layout of that element's bounding box. For more information, see Element Bounding Boxes later in this topic.

To override the default Panel layout behavior, each type of Panel provides its own MeasureOverride and ArrangeOverride methods in order to achieve its own specific layout behavior. This is the series of events that occurs whenever the layout system is invoked:

  1. Each child UIElement is measured.
  2. Sizing properties defined on FrameworkElement are evaluated, such as Width, Height, and Margin.
  3. Panel-specific logic is applied, such as stacking Orientation.
  4. Content is arranged after all children have been measured.
  5. The Children collection is drawn to the screen.
  6. The process is invoked again if additional Children are added to the collection, layout properties on the Children such as Width and Height change, or the UpdateLayout method is called.

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.
6 Months Free & No Setup Fees ASP.NET 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 ... 
6 Months Free & No Setup Fees ASP.NET Hosting!
 © 2012  contents copyright of their authors. Rest everything copyright Mindcracker. All rights reserved.