You are previewing XAML Developer Reference.
O'Reilly logo
XAML Developer Reference

Book Description

Your expert guide to designing and building dynamic user interfaces

Sharpen your application design and development skills using XAML—the declarative markup language used in Microsoft Silverlight and Windows Presentation Foundation (WPF). Led by two XAML experts, you’ll learn practical ways to build rich, interactive user interfaces with data integration capabilities and support for multimedia, graphics, and animation. This hands-on guide is ideal for Microsoft .NET developers and web designers alike.

Discover how to:

  • Control UI behavior and implement business logic with code-behind solutions

  • Manage UI element positioning with the XAML layout system

  • Use templates to customize UI elements—without affecting their functionality

  • Apply different types of property and event systems in WPF and Silverlight

  • Bind various kinds of data to your UI, and display them in the format you want

  • Implement 2D and 3D vector graphics and animations

  • Reuse control styles and properties to maintain consistency throughout your application

  • Table of Contents

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