XAML Unleashed

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

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

Author(s): Adam Nathan
Series: Unleashed
Publisher: Sams Publishing
Year: 2014

Language: English
Commentary: Downloaded from https://www.oreilly.com/library/view/xaml-unleashed/9780133967401/ using OReilly Downloader
Pages: 975

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