Prev | Current Page 352 | Next

Matthew MacDonald

"Pro WPF with VB 2008: Windows Presentation Foundation with .NET 3.5"


nNote Some controls don??™t respect the BorderBrush and BorderThickness properties. The Button object
ignores them completely because it defines its background and border using the ButtonChrome decorator.
However, you can give a button a new face (with a border of your choosing) using templates, as described
in Chapter 15.
Transparency
Unlike Windows Forms, WPF supports true transparency. That means if you layer several elements
on top of one another and give them all varying layers of transparency, you??™ll see
exactly what you expect. At its simplest, this feature gives you the ability to create graphical
backgrounds that ???show through??? the elements you place on top. At its most complex, this
feature allows you to create multilayered animations and other effects that would be
extremely difficult in other frameworks.
There are two ways to make an element partly transparent:
??? Set the Opacity property. Opacity is a fractional value from 0 to 1, where 1 is completely
solid (the default) and 0 is completely transparent. The Opacity property is
defined in the UIElement class (and the base Brush class), so it applies to all elements.
??? Use a semitransparent color. Any color that has an alpha value less than 255 is semitransparent.
If possible, you should use transparent colors rather than the Opacity
property because it??™s likely to perform better.


Pages:
340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364