Windows Presentation Foundation 4: Brushes and Colors

Windows Presentation Foundation 4: Brushes and Colors

2h 20mIntermediate2017-01-19

Authors

Walt Ritscher

Walt Ritscher

Programmer, UI Designer, Staff Instructor at LinkedIn Learning

Course details

Windows Presentation Foundation (WPF) in Visual Studio 2015 provides developers with a unified programming model for building modern user interfaces for Windows desktop applications. One of the most important aspects of any UI is color; learn how WPF tools like brushes and the visual Color Editor can help you create more appealing and engaging user experiences. Walt Ritscher introduces the solid, gradient, and tiled brushes; explains what properties are "brushable"; and shows how to specify color using RGB values, hexadecimal notation, and the sRGB color space. Plus, learn how to use opacity masks to adjust the transparency of different elements, and how to store brushes and colors in XAML resources so they are easily reusable and accessible from anywhere within Visual Studio.

Learning objectives
Working with brushes
Painting properties
Painting in code
Working with RGB channels
Using hexadecimal values
Setting opacity and transparency
Editing color in the Visual Studio Color Editor
Using gradient brushes
Decorating with tiled brushes
Adding brushes and colors to resources
Working with opacity masks

Skills covered

Microsoft DevelopmentVisual StudioWindowsMicrosoftSoftware Development

Concepts

Introduction

  • Welcome
  • What you should know before watching
  • Disable the WPF debugging tool
  • Use the exercise files

Brush and Color Overview

  • Overview of the brushes
  • Examples of the brushes
  • Which properties are brushable
  • Paint with a SolidColorBrush in code
  • Paint with a SolidColorBrush in XAML
  • The Brush type converter

Colors

  • Color and colorspaces
  • Work with RGB channels
  • Use hexadecimal color values
  • Opacity and transparency
  • sRGB colorspace
  • Use WPF preset colors

The Visual Studio Color Editor

  • Basics
  • Use the Eyedropper
  • Use HSL and CMYK color values

The Gradient Brushes

  • Why use gradients in the UI
  • Banded colors with LinearGradientBrush
  • Create a LinearGradientBrush with Property window
  • Transform gradients
  • Create rings with a RadialGradientBrush
  • Build a sample UI with gradients

The Tiled Brushes

  • Decorate elements using the ImageBrush
  • Set tiled properties using the TileBrush
  • Clone UI elements using the VisualBrush
  • Paint with video using the VisualBrush

Brushes and Colors in Resources

  • Add colors to XAML resources
  • Add brushes to XAML resources
  • Use system color resources

Opacity Mask

  • Overview of an Opacity Mask
  • Examples of opacity patterns

Conclusion

  • Next steps
80,000 Toman