I'm a noob to .net in general, working on my first metro style app and can't find a way to add a simple drop shadow to some of my UI elements. I've heard that it may not be possible to do simple UI effects such as this with winRT and was wondering if these rumors are true. If so, does anyone have a work around for this effect?
Asked
Active
Viewed 3,071 times
1
-
You should not use shadows... It is against the Metro style – Rico Suter Jun 28 '12 at 23:08
-
This WPF sample should also work for Win8 XAML: http://stackoverflow.com/questions/2831062/wpf-drop-shadow – Rico Suter Jun 28 '12 at 23:09
-
Win8 has no Effect tag. – Erti-Chris Eelmaa Mar 19 '13 at 18:34
4 Answers
2
If you are building a Metro app in xaml, there are no built in bitmap effects (like drop shadow, blur, glow and reflection). You may be able to create a bitmap image of a drop shadow and use it as a 9 grid, but that will only work in some scenarios.
If you use html+css+js, you can use CSS3 bitmap effects to create a drop shadow on a box.

Robert Sweeney
- 186
- 1
- 6
2
Here's a solution for creating a 4 pixel wide shadow, copied from the default template for ChildWindow in Silverlight --
<Grid>
<Border BorderBrush="#14000000" BorderThickness="1" Background="#14000000" CornerRadius="2" Margin="1,1,-1,-1"/>
<Border BorderBrush="#0F000000" BorderThickness="1" Background="#0F000000" CornerRadius="2.25" Margin="2,2,-2,-2"/>
<Border BorderBrush="#0C000000" BorderThickness="1" Background="#0C000000" CornerRadius="2.5" Margin="3,3,-3,-3"/>
<Border BorderBrush="#0A000000" BorderThickness="1" Background="#0A000000" CornerRadius="2.75" Margin="4,4,-4,-4" />
<Border BorderBrush="Black" BorderThickness="1" Background="#FFFFFFFF" CornerRadius="2">
...Actual content...
</Border>
</Grid>

foson
- 10,037
- 2
- 35
- 53
0
For XAML Metro/Modern apps, this XAML drop shadow sample works perfectly

Alex Sorokoletov
- 3,102
- 2
- 30
- 52
0
BCL doesn't support shadow, but win2d(https://github.com/Microsoft/win2d) support.
you can use CanvasControl of win2d or try this library based on win2d https://github.com/brookshi/XPShadow

Brook Shi
- 21
- 3
-
While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/10904857) – Dmitriy Jan 15 '16 at 12:30
-