See how the ColorConverter and BrushConverter work to interpret XAML strings and how to convert XAML strings to a color hue or a SolidColorBrush.
- Let's review what's happening…inside this application.…Now I have an ellipse and I'm assigning…a orange brush to this fill property…and I'm doing it through this verbose syntax.…The key thing I want to look at is line 57.…Right here I have a string value…that I'm attempting to assign to the color.…Now these are mismatched types.…This is a color structure and this is a string.…That means that the XML parser is going to reject that…unless it can find what is called a type converter…and invoke that instead.…
So here's what's really happening.…Let's go over and look at this class diagram.…I have this brush, the SolidColorBrush,…has this color property…and the type of this color property is Color.…So the color property is of type Color…which is this color structure here…and there is also a ColorConverter class…that's affiliated with this.…If you were to look at Microsoft source code…it would look sort of like this.…I've got two example classes in here…that I wrote that are similar…to what Microsoft would have created.…
- 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
Skill Level Intermediate
Windows Presentation Foundation: 2 Layoutwith Walt Ritscher2h 13m Intermediate
1. Brush and Color Overview
3. The Visual Studio Color Editor
4. The Gradient Brushes
5. The Tiled Brushes
6. Brushes and Colors in Resources
7. Opacity Mask
Examples of opacity patterns6m 47s
Next steps1m 11s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.