Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
XAML Developer Reference
Introduction
Who Should Read This Book
Assumptions
Who Should Not Read This Book
Organization of This Book
Finding Your Best Starting Point in This Book
Conventions and Features in This Book
System Requirements
Code Samples
Installing the Code Samples
Using the Code Samples
Acknowledgments
Errata & Book Support
We Want to Hear from You
Stay in Touch
I. XAML Basics
1. Introducing XAML
Windows Presentation Foundation (WPF)
XAML—A Declarative Language for .NET Applications
XAML Is Part of the Microsoft Open Specification Program (OSP)
XAML Structure
Dynamic User Interface
Decouple Control Style Definitions
Customized Design of XAML Controls
Integration with Code-Behind to Control Behavior
Inline Code
Silverlight
The Microsoft .NET Framework
Design-Time Components
Runtime Cross-Platform Components
Summary
2. Object Elements and Attributes
XAML Is XML
Root Element
XAML Namespaces
The Default WPF Namespace
The XAML (x:) Namespace
Additional Namespaces for Silverlight Applications
The Designer (d:) Namespace
The Markup Compatibility (mc:) Namespace
The Silverlight SDK (sdk:) Namespace
The Silverlight Toolkit (toolkit:) Namespace
Additional Namespaces for WF Activities Application
The System.Activities.Presentation.View (sapv:) Namespace
Default User Interface Element
Introducing the XAML Presentation Framework
WPF and Silverlight Presentation Framework
Defining User Interfaces with XAML
Object Elements
Object Element Properties
Attribute Syntax
Property Element Syntax
Content Element Syntax
Collection Element Syntax
XAML User Interface Controls
Layout and Positioning Controls
Form Controls
Functional Controls
Making the User Interface Cleaner and More Usable
Controlling and Monitoring Application and Content Behavior
Dialog Boxes
Data Handling and Information Management Controls
Image and Media Controls
Graphics and Animation Controls
Summary
3. XAML Properties and Events
XAML Properties
Dependency Properties
Defining a Dependency Property
The DependencyProperty Class
The DependencyObject Class
Creating a Custom Dependency Property
Create a custom dependency property in the XAML code-behind file
Access and bind a custom dependency property to a XAML control within a XAML file
Accessing a Dependency Property from Code-Behind
Dependency Property Value Precedence
Read-Only Dependency Properties
Attached Properties
Why Use Attached Properties?
The Syntax
Defining Read/Write and Read-Only Attached Properties
Creating a Custom Attached Property
Create a custom attached property in the XAML code-behind file
Access a custom attached property for a XAML control within a XAML file
Accessing an Attached Property from Code-Behind
XAML Events
The Syntax
Routed Events
The RoutedEventArgs Class
Add and Remove Event Handlers Using Code-Behind
Creating Custom Routed Event
Attached Routed Events
The EventSetter and EventTrigger Classes
The EventSetter Class
The EventTrigger Class
Summary
II. Enhancing User Experience
4. Markup Extensions and Other Features
Markup Extensions
Built-In XAML Markup Extensions
x:Null
x:Array
x:Reference
x:Static
x:Type
XAML Markup Extensions Used in WPF and Silverlight
Escape Sequences
Custom Markup Extensions
Type Converters versus Markup Extensions
XAML Services
Security in XAML
Summary
5. Resources, Styles, and Triggers
Resources
Types of Resources
Static Resources
Defining Static Resources Using XAML
Defining Static Resources Programmatically
Dynamic Resources
When to Use Which Resource
How Static and Dynamic Resources Work
Defining ResourceDictionary Files
Merged Resource Dictionaries
Scope and Hierarchy of Resources
Styles
Defining Styles
Implicit Styles
Inheriting Styles
The Silverlight Toolkit Styles
Styles vs. Control Templates
More on Styles
The generic.xaml File
Triggers
Property Triggers
Event Triggers
MultiTriggers
DataTrigger
Interaction Triggers
Troubleshooting Resources, Styles, and Triggers
Summary
III. XAML User Interface Controls
6. Layout and Positioning System
The Layout System
XAML Layout and Positioning Controls
Canvas
StackPanel
Grid
Defining the Grid
Sizing Grid Columns and Rows
Proportional sizing
Absolute sizing
Automatic sizing
Adding Content to Grid
UniformGrid
WrapPanel
DockPanel
TabPanel
Common Sizing and Positioning Properties
Sizing Properties
Alignment Properties
Controls Position Alignment
Controls Content Alignment
Margin Property
Padding Property
Visibility Property
Summary
7. Form and Functional Controls
Action Controls
The ButtonBase Class
Button
HyperlinkButton
RepeatButton
ToggleButton
CheckBox
RadioButton
An Example
Text Editing Controls
The TextBoxBase Class
TextBox
RichTextBox
TextBox and RichTextBox Example
PasswordBox
StickyNoteControl
Functional Controls to Improve Usability
Label
TextBlock
Border
ToolTip
Menu
ContextMenu
ContextMenu for WPF Platform
ContextMenu for Silverlight
Functional Controls to Control and Monitor Behavior
The RangeBase Class
ScrollBar
Slider
ProgressBar
ScrollViewer
Summary
IV. Content Integration and Animation
8. Data Binding
Data Sources
Service
Object
SharePoint
Database
Data Binding
Setting the Binding Source
The DataContext Property
The Source Property
Inheriting the DataContext Property from the Parent Element
The ElementName Property
The RelativeSource Property
Ancestor RelativeSource
MultiBinding
Binding to Data from a Database
Binding Modes
Example of Two-Way Binding with TextBox
Source Updates
Data Templating, Conversion, and Validation
Data Templating
Data Conversion
Data Validation
Creating and Binding to an ObservableCollection
Collection Views
Sorting and Grouping Using a CollectionView
Hierarchical Binding
Using HierarchicalDataTemplate
Using ObservableCollection for Hierarchical Binding
Binding to XML Data
Summary
9. Media, Graphics, and Animation
Media
Images
Audio and Video
Graphics
Ellipse
Rectangle
Rounded Rectangle
Polygon
Polyline
Path
Geometries
Brushes
Transforms
RotateTransform
ScaleTransform
SkewTransform
Complex Transformations
3-D Graphics
3-D Graphics in WPF
PerspectiveCamera
OrthographicCamera
MatrixCamera
Defining Shapes
3-D Graphics in Silverlight
Pixel Shaders
Custom Shaders
Animations and Storyboards
Using Expression Blend for Storyboards and Animations
Types of Animations
Working with Storyboards
Defining Storyboards in Styles
Easing Functions
Summary
V. Appendixes
A. Major Namespaces and Classes
Commonly Used Namespaces and Classes in WPF
System.Windows.Controls Namespace
System.Windows.Data Namespace
System.Windows.Shapes Namespace
System.Windows.Media Namespace
System.Windows.Media.Animation Namespace
Commonly Used Namespaces and Classes in Silverlight
System.Windows.Controls Namespace
System.Windows.Data Namespace
System.Windows.Documents Namespace
System.Windows.Media Namespace
System.Windows.Media.Effects Namespace
B. XAML Editors and Tools
Editors
Kaxaml
Requirements
XAML Cruncher
XamlPad
XamlPadX
Tools
Shazzam
Ab3d.Reader3ds - 3ds file importer
XAML Power Toys 3.5
Aurora XAML Designer
C. About the Authors
Index
About the Authors
← Prev
Back
Next →
← Prev
Back
Next →