1

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?

user1486576
  • 11
  • 1
  • 2

4 Answers4

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
  • I know why I get two negative vote in 10 minute, thank you :) – Brook Shi Jan 15 '16 at 13:14