See how to use the Microsoft Silverlight 2 control model to efficiently design and develop custom controls, style existing controls, create control templates, and package your controls for re-use to develop Rich Internet Applications. Also hear about the capabilities for localization and accessibility.
5. Scenario
Fixed look with some logic
Split large page into smaller chunks
Reuse xaml/logic in multiple places
Platform Support
<UserControl x:Class=“MyControl”> … </>
public partial class MyControl : UserControl {}
XAML is optional
6. Update from 1.1 Alpha
Replaces Control.InitializeFromXaml(“…”)
A Silverlight “page” is a UserControl
Visual elements
Databinding
Tabbing
Mouse & keyboard events
… and so on
7.
8. Complete keyboard accessibility
Full tab navigation support
Full focus support
Can implement own directional navigation
Screen reader support coming in Beta2
Based on UIAutomation
Mark Rideout’s video:
Some additional work for full 508 compliance
High Contrast
9.
10. Scenario
Tweek minor visual characteristics
Platform Support
Manually setting visual properties on control
<Style>
11.
12. Resources
A shared XAML asset that can be referenced
by multiple elements in your application.
<Style>
A set of properties that can be applied to
controls, text, shapes, …
Silverlight 2
“Write once” behavior
Application theme styles not supported
BasedOn styles not supported
13. Scenario
Completely replace control’s visuals
Platform Support
<ControlTemplate>
14.
15. <ControlTemplate>
A set of elements that make up the visual
structure of a control.
{TemplateBinding}
A link between the template visuals and the
control’s visual properties
16.
17. Scenario
Piece of custom logic
Designers can customize look
Platform Support
Derive from Control class
Supply built-in style
20. I wonder
I need a I’ve got your
what I need
RootElement, RootElement,
Pressed to put in State,
Pressed my
template…
State, etc.. etc..
21. Goals
How to structure your control
Defined separation between logic & visuals
Explicit control contract
Recommended pattern
Not enforced by runtime
Will be supported by Blend
22. Element Parts
Named element in template
Type: FrameworkElement, Panel, Button, etc..
Control logic will control element in some way
DownButton Thumb UpButton
Track
23. States Parts
Keyed resource inside template’s root element
Type: Storyboard
Control logic begins & stops storyboard
Initiator
Code starts/stops
Transition
animation.
Mouse
Over Pressed
STATE part