Skip to Content
Professional Visual Basic 2012 and .NET 4.5 Programming
book

Professional Visual Basic 2012 and .NET 4.5 Programming

by Bill Sheldon, Billy Hollis, Rob Windsor, David McCarter, Gastón Hillar, Todd Herman
January 2013
Intermediate to advanced
912 pages
26h 58m
English
Wrox
Content preview from Professional Visual Basic 2012 and .NET 4.5 Programming

The Layout System

The previous XAML example indicates an interesting aspect of XAML interfaces. The XAML didn't set the width of the Border, the StackPanel, the Button, the Image, or the TextBox. Only the UserControl's width was declared. Everything else automatically sized itself, based on the width of its container.

You can create XAML interfaces in which all sizes and positions are explicitly declared, just like you can in older technologies such as Windows Forms. For most applications, that is most assuredly not recommended. You'll take maximum advantage of XAML by using its built-in features for sizing and positioning visual elements. Used properly, these features can allow your application to run at varying resolutions and sizes. (Wouldn't it be nice to stop those arguments about whether to support 800×600 or 1024×768 or 1280×1024?)

Measurement Units

To explicitly set size and position of units in XAML, a special type of unit is used. It can be thought of as a “virtual pixel.” That is, under default conditions (default desktop dots per inch, for example), one unit will correspond to one pixel. But there are some important differences.

First, the properties holding the units are not integers, as would be common with older pixel-based technologies. The properties are of type Double. This allows applications to have a finer grain, which is important if an element is zoomed, for example.

Second, changing factors such as desktop dpi or the browser zoom factor for Silverlight applications ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Visual Basic 2012 Programmer's Reference

Visual Basic 2012 Programmer's Reference

Rod Stephens

Publisher Resources

ISBN: 9781118332139Purchase book