An Opacity Mask is another way to set the opacity of an element. The main benefit of the mask is that it allows varied patterns of transparency on the target element.
- [Instructor] In WPF, there are two ways…to change the opacity of an element.…The first is to set the opacity property.…The second is to use a brush and apply it…to the opacity mask property.…We'll start by showing you the opacity property,…and, to do that, I'll work with this demonstration here.…I've got a window, and it has a grid.…And the background of the grid is coming from a brush…that is defined in my window resources section.…So I've got an image brush defined here,…and I'm applying that brush to the background.…
Now you can't see the background yet,…because I've got this flower image.…And it's the same size as the grid,…so all you see is the image.…To make the image invisible,…I'll set the visibility property to hidden.…And now you can see this orange and yellow…and black oil texture that I have in the background.…To make the flower image transparent, or semi-transparent,…I can go to the opacity property…and set this to a value less than one.…
I set it to 0.5, it's now 50% transparent.…And now you can see the flower is superimposed…
- 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?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
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.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.