For a given XAML layout that requires a semi-transparent white (to provide a glass-like effect in this case), which method would be preferable to set the transparency and why?:
#12FFFFFF
Also, is the answer different between WPF (4.0) and Silverlight?
Straight from MSDN:
Opacity on Brushes versus Opacity on Elements
When you use a Brush to set the Fill or Stroke of an element, it is better to set the Brush.Opacity value rather than the setting the element's Opacity property. Modifying an element's Opacity property can cause WPF to create a temporary surface.
But regardless, note that you're still causing the rendering pipeline to do more work. Opacity implies it must combine pixels from multiple sources in order to come up with the final RGB value. Thus, if it's at all possible to remove the transparency altogether and instead simulate it with an opaque brush, you should. It sounds like that may not be possible in your case, but it often can be.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With