Layout and Formatting with Windows 8 XAML Development

When designing a user experience, one of the first things you need to figure out is where to position things on the screen, how they should flow when the content changes, and what shape or color they should be. This article is about the tools you have at your disposal with Windows 8 XAML to control layout and formatting on this exciting new platform.


The first thing you can use to change the format of a control is a Brush. Windows 8 XAML exposes the following:

The Shape objects have the following format properties:

Border has the following properties:

Control has the following property:

Control, TextBlock, TextBox and RichTextBlock support a lot of text formatting properties, such as:

TextBlock also has an Inlines property, while RichTextBlock has a Blocks property for Paragraph objects that also have Inlines properties – all of which can be used to provide rich inline formatting of text, including embedding UI elements, like an Image or a Rectangle.

The text controls also support advanced typography parameters through attached properties of the Typography class.


The following basic properties control the base size and position of properties:

Apart from specifying layout properties directly on a control as mentioned above, you can place the controls inside of one of the panels that provide various approaches to laying out controls in space.

Custom panels can be implemented to provide custom layout logic.


After the logical layout of the control on the screen, rendering transformations allow you to further adjust positioning of the controls. Note that these don’t affect the RenderSize, ActualWidth or ActualHeight properties. The positioning of controls using these properties is slightly more difficult since changes to these properties don’t affect other controls on screen, so each control needs to be configured individually. It does not need to run on a UI thread, and that makes the layout faster, so these properties are recommended for use in animations and animating:

Note that you can also apply transforms to a Brush or a Geometry:


The Windows 8 XAML platform provides a very large set of properties to control the format and layout of controls that are almost identical to that of WPF or Silverlight with rare, but notable exceptions. The layout logic mechanisms are extendible through custom Panel implementations and formatting can be further customized by DirectX interop.

Safari Books Online has the content you need

Below are some Windows 8 books to get you started, or you can check out all of the Windows 8 books and training videos available from Safari Books Online. You can browse the content in preview mode or you can gain access to more information with a free trial or subscription to Safari Books Online.

Building Windows 8 Applications with C# and XAML shows you how to build immersive, responsive touch apps for Windows 8 tablets, computers, and other devices! Top Microsoft MVP and Wintellect consultant Jeremy Likness shows how to leverage your existing C#, XAML, WPF, or Silverlight skills with new Visual Studio 12 tools and best practices to build incredibly powerful Windows 8/WinRT apps!
With the official release of Windows 8 looming ever closer, experienced author Adam Freeman invites you to take a crash course in Metro development in Metro Revealed: Building Windows 8 Apps with HTML5 and JavaScript. Using HTML5 and JavaScript, he ensures you understand the changes that are being made to Windows development practices and puts you on the right course to creating innovative and elegant applications for this latest evolution of the world’s most successful operating system.
Get a head start on building apps for Windows 8. With a series of examples, Getting Started with Windows 8 Apps takes you through the process of creating complete touch-enabled apps that respond to native sensors. Through the course of the book, you’ll learn how to work with the Windows Runtime application model while building a Bing Image Search app.

Start your FREE 10-day trial to Safari Books Online

About the Author

Filip Skakun is a Sr. Interactive Developer at Vectorform, where he creates user experiences for the world’s top brands, using the new and upcoming technologies. He is also the creator of the WinRT XAML Toolkit, a popular library for Windows 8 XAML developers. You can catch him on twitter.

About Safari Books Online

Safari Books Online is an online learning library that provides access to thousands of technical, engineering, business, and digital media books and training videos. Get the latest information on topics like Windows 8, Android Development, iOS Development, Cloud Computing, HTML5, and so much more – sometimes even before the book is published or on bookshelves. Learn something new today with a free subscription to Safari Books Online.

Comments are closed.