XAML Unleashed

Book description

Full Color: Figures and code appear as they do in Visual Studio.

If you want to write Windows apps with XAML, one person can help you more than anyone else: Adam Nathan. He has built a well-deserved reputation as the world’s #1 expert on putting it to work. Now, he’s written the definitive, practical XAML tutorial and reference: XAML Unleashed.

Nathan answers the questions you’re most likely to ask, walks through the tasks you’re sure to perform, and helps you avoid problems as you use XAML. You’ll learn how to create effective user interfaces for line-of-business apps, consumer apps, reusable controls, or anything else. These techniques will be invaluable whether you’re creating universal Windows apps or working with Silverlight or WPF.

XAML Unleashed is packed with C# and XAML code examples that are fully color-coded to match their appearance in Visual Studio--the same approach that has made Nathan’s previous Unleashed books so popular.

Detailed information on how to...

  • Understand and apply XAML’s syntax, namespaces, and keywords

  • Organize controls and other elements in a smooth and intuitive user interface

  • Make the most of XAML’s rich controls for content, items, images, text, and media

  • Build exceptionally powerful user and custom controls

  • Master reliable and efficient ways to mix XAML with procedural code

  • Extend XAML with type converters, markup extensions, and other third-party desktop classes

  • Use data binding to link and synchronize controls with in-memory representations of data

  • Leverage XAML’s support for binary and logical resources

  • Use styles, templates, and visual states to radically redesign controls without sacrificing their built-in functionality

  • Access the Windows animation library to create stunning theme transitions and animations

  • Build custom panels to enforce consistency in unusual user interfaces

  • Understand subtle changes in XAML’s behavior across different Microsoft UI frameworks

  • Table of contents

    1. About This eBook
    2. Title Page
    3. Copyright Page
    4. Contents at a Glance
    5. Table of Contents
    6. About the Author
    7. Dedication
    8. Acknowledgments
    9. We Want to Hear from You!
    10. Reader Services
    11. Introduction
      1. In This Chapter
      2. Who Should Read This Book?
      3. Code Examples
      4. How This Book Is Organized
        1. Part I: The XAML Language
        2. Part II: Graphics
        3. Part III: Controls
        4. Part IV: Exploiting XAML Features
        5. Part V: Advanced Features
      5. Conventions Used in This Book
    12. Part I: The XAML Language
      1. Chapter 1. What Is XAML?
        1. Elements and Attributes
        2. Namespaces
        3. Property Elements
        4. Summary
      2. Chapter 2. Child Elements and Keywords
        1. Children of Object Elements
          1. The Content Property
          2. Collection Items
        2. XAML Keywords
        3. Summary
      3. Chapter 3. Mixing XAML with Code
        1. Loading and Parsing XAML at Runtime
          1. XamlReader
          2. Naming XAML Elements
        2. Compiling XAML
          1. Binary XAML
          2. Generated Source Code
        3. Summary
      4. Chapter 4. Extending XAML
        1. Type Converters
          1. Custom Type Converters
          2. Type Conversion of an Element’s Contents
        2. Using Arbitrary Types in XAML
          1. Referencing .NET/WinRT Namespaces in XAML
          2. Using Built-in System Data Types
          3. Declaring Arrays
          4. Referencing Static Fields and Properties
        3. Markup Extensions
        4. Some Notes About XAML2009
          1. Full Generics Support
          2. Dictionary Keys of Any Type
          3. Built-in System Data Types
          4. Instantiating Objects with Nondefault Constructors
          5. Getting Instances via Factory Methods
          6. Event Handler Flexibility
          7. Defining New Properties
        5. Summary
    13. Part II: Graphics
      1. Chapter 5. Arranging Elements
        1. Controlling Size
          1. Height and Width
          2. Margin and Padding
          3. Visibility
        2. Controlling Position
          1. Alignment
          2. Content Alignment
          3. FlowDirection
        3. Applying 2D Transforms
          1. RotateTransform
          2. ScaleTransform
          3. SkewTransform
          4. TranslateTransform
          5. Combining Transforms
        4. Applying 3D Transforms
        5. Summary
      2. Chapter 6. Automatic Layout
        1. Canvas
        2. StackPanel
        3. DockPanel
        4. Grid
          1. Sizing the Rows and Columns
          2. Comparing Grid to Other Panels
        5. VariableSizedWrapGrid and WrapPanel
        6. Primitive Panels
          1. TabPanel
          2. ToolBarPanel
          3. ToolBarOverflowPanel
          4. ToolBarTray
          5. UniformGrid
          6. SelectiveScrollingGrid
        7. Handling Content Overflow
          1. Clipping
          2. Scrolling
          3. Scaling
        8. Summary
      3. Chapter 7. 2D Graphics
        1. Shapes
          1. Rectangle
          2. Ellipse
          3. Line
          4. Polyline
          5. Polygon
          6. Path
          7. Getting Fancy with Strokes
        2. Geometries
          1. PathFigures and PathSegments
          2. GeometryGroup
          3. Representing Geometries as Strings
        3. Brushes
          1. Color Brushes
          2. Tile Brushes
        4. Summary
      4. Chapter 8. 3D Graphics
        1. Getting Started with 3D Graphics
        2. Cameras and Coordinate Systems
          1. Position
          2. LookDirection
          3. UpDirection
          4. OrthographicCamera Versus PerspectiveCamera
        3. Transform3D
          1. TranslateTransform3D
          2. ScaleTransform3D
          3. RotateTransform3D
          4. Combining Transform3Ds
        4. Model3D
          1. Lights
          2. GeometryModel3D
          3. Model3DGroup
        5. Visual3D
          1. ModelVisual3D
          2. UIElement3D
          3. Viewport2DVisual3D
        6. Viewport3D
        7. 2D and 3D Coordinate System Transformation
          1. Visual.TransformToAncestor
          2. Visual3D.TransformToAncestor and Visual3D.TransformToDescendant
        8. Summary
    14. Part III: Controls
      1. Chapter 9. Content Controls
        1. Button
        2. HyperlinkButton
        3. RepeatButton
        4. ToggleButton
        5. CheckBox
        6. RadioButton
        7. ToolTip
        8. Summary
      2. Chapter 10. Items Controls
        1. Items in the Control
        2. Items Panels
        3. ComboBox
        4. ListBox
        5. ListView
          1. Richer ScrollIntoView
          2. Header and Footer
          3. Selection
          4. Reordering Items
          5. Data Virtualization
          6. Incremental Item Rendering
        6. GridView
        7. Summary
      3. Chapter 11. Images
        1. The Image Element
          1. Referencing Files with URIs
          2. Custom Stretching with Nine-Grid
          3. Generating Dynamic Images with WriteableBitmap
          4. Generating Dynamic Images with RenderTargetBitmap
        2. Multiple Files for Multiple Environments
          1. Loading File Variations Automatically
          2. Loading File Variations Manually
          3. Leveraging Resource Packages
        3. Decoding Images
          1. Getting Pixel Data
          2. Reading Metadata
        4. Encoding Images
          1. Writing Pixel Data
          2. Writing Metadata
          3. Transcoding
        5. Summary
      4. Chapter 12. Text
        1. TextBlock
          1. Properties Introduced in Windows 8.1
          2. Text Content
          3. Text Elements
          4. Text Selection
        2. RichTextBlock
          1. Embedding UIElements
          2. Text Overflow
        3. TextBox
          1. Spelling and Text Prediction
          2. Text Selection
          3. InputScope and the Software Keyboard
        4. RichEditBox
        5. PasswordBox
        6. Summary
      5. Chapter 13. Audio and Video
        1. Playback
          1. The Media Content
          2. Customizing Playback
          3. States and Events
          4. Markers
          5. Adding Effects
          6. Using MediaElement as a Media Player
          7. MediaPlayer
          8. Playing Custom Media Formats
        2. Capture
          1. CameraCaptureUI
          2. CaptureElement
        3. Transcoding
          1. Changing the Quality
          2. Changing the Format
          3. Trimming
          4. Adding Effects
        4. Summary
      6. Chapter 14. Other Controls
        1. Range Controls
          1. ProgressBar
          2. Slider
        2. Popup
        3. Hub
          1. HubSections
          2. Jumping to a HubSection
        4. DatePicker
        5. TimePicker
        6. ProgressRing
        7. ToggleSwitch
        8. Summary
      7. Chapter 15. User Controls and Custom Controls
        1. Creating a User Control
          1. Creating the User Interface
          2. Creating the Behavior
          3. Consuming the User Control
        2. Creating a Custom Control
          1. Creating the Behavior
          2. Creating the User Interface
          3. Consuming the Control
          4. Making the Control “Lookless”
        3. Summary
    15. Part IV: Exploiting XAML Features
      1. Chapter 16. Resources
        1. Binary Resources
          1. Binary Resources in WPF
          2. Binary Resources in Windows Store and Universal Apps
        2. Logical Resources
          1. Resource Lookup
          2. Static Versus Dynamic Resources
          3. Theme Resources
        3. Summary
      2. Chapter 17. Data Binding
        1. Introducing Binding
          1. Using Binding in C#
          2. Binding to Plain Properties
          3. Customizing the Data Flow
          4. Sharing the Source with DataContext
          5. Binding to a Collection
        2. Controlling Rendering
          1. Using Data Templates
          2. Using Value Converters
        3. Customizing the View of a Collection
          1. Grouping
          2. Navigating
        4. Summary
      3. Chapter 18. Styles, Templates, and Visual States
        1. Styles
          1. Using a Base TargetType
          2. Style Inheritance
          3. Implicit Styles
        2. Templates
          1. Introducing Control Templates
          2. Respecting the Target Control’s Properties
          3. Setting Template Inside a Style
        3. Visual States
          1. Responding to Visual State Changes
          2. Visual Transitions
        4. Summary
      4. Chapter 19. Animation
        1. Theme Transitions
          1. Applying Theme Transitions to Elements
          2. Examining the Theme Transitions
        2. Theme Animations
          1. Using a Storyboard
          2. Examining the Theme Animations
          3. Tweaking Theme Animations
        3. Custom Animations
          1. Independent Versus Dependent Animations
          2. Controlling Duration
          3. Flexibility with From and To
          4. Tweaking Animations with Timeline Properties
          5. Storyboards with Multiple Animations
          6. Property Paths
          7. Tweaking Storyboards with Timeline Properties
        4. Custom Keyframe Animations
          1. Linear Keyframes
          2. Spline Keyframes
          3. Discrete Keyframes
          4. Easing Keyframes
        5. Easing Functions
          1. Power Easing Functions
          2. Other Easing Functions
        6. Manual Animations
        7. Summary
    16. Part V: Advanced Features
      1. Chapter 20. Layout with Custom Panels
        1. Communication Between Parents and Children
          1. The Measure Step
          2. The Arrange Step
        2. Creating a SimpleCanvas
        3. Creating a SimpleStackPanel
        4. Creating a UniformGrid
        5. Summary
      2. Chapter 21. Fun with XAML Readers and Writers
        1. System.Xaml Overview
        2. The Node Loop
        3. Reading XAML
        4. Writing to Live Objects
        5. Writing to XML
        6. XamlServices
        7. Summary
    17. Index
    18. Code Snippets

    Product information

    • Title: XAML Unleashed
    • Author(s):
    • Release date: December 2014
    • Publisher(s): Sams
    • ISBN: 9780133967401