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

Control Templates

A Style can set just about any property of an element. The examples in the Style section show rather prosaic properties affecting fonts and such. However, a Style for a ListBox could set the ItemTemplate property to a particular DataTemplate, which has more dramatic effects.

For controls, a Style can also set a very important property named Template. That property points to a control template, which determines the visualization of the control.

“Lookless” Controls

In XAML, the behavior of a control, that is, how it responds to user actions in code, is completely separate from the way the control is rendered. In fact, the code for a control normally doesn't contain any information about how the control is rendered at all. The control's rendering is specified by a control template.

Control authors include a default control template in controls. That way, when the control is placed in a XAML page, a default rendering is in place, and the control can be seen and used.

However, that rendering is just the default. The control template can be changed. The new template can make the control look radically different, using any of the visual elements available in XAML.

Reskinning a CheckBox

Suppose you want a CheckBox to control whether a microphone is turned on or off. You could just drag over a CheckBox and be done with it, and from a functional perspective, that would work. However, usability would be significantly enhanced if you could make the CheckBox indicate its function ...

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