Pregunta

¿Hay una manera de hacer que la sombra del primer control en un StackPanel aparecen en la parte superior del segundo control? Estoy teniendo problemas con esto, mira el cuadro!
alt texto http://img2.imageshack.us/img2/7073/issuef.png muestra
Código:

 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
          xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
          xmlns:sys="clr-namespace:System;assembly=mscorlib">
         <Grid>
         <StackPanel>
            <Border Height="100" Width="100" Background="Red">
                <Border.BitmapEffect>
                    <DropShadowBitmapEffect Color="Black" Direction="270" ShadowDepth="3" Opacity="1" Softness="2" />
                </Border.BitmapEffect>
            </Border>
                <Border Height="100" Width="100" Background="blue">
                </Border>
            </StackPanel>
        </Grid>
    </Page>
¿Fue útil?

Solución

Se puede hacer uso Panel.ZIndex="0" en cada uno de los bordes para establecer el orden z de los elementos directamente desde el XAML.

<StackPanel>
    <Border Height="100" Width="100" Background="Red" Panel.ZIndex="1">
        <Border.BitmapEffect>
            <DropShadowBitmapEffect Color="Black" Direction="270" ShadowDepth="3" Opacity="1" Softness="2" />
        </Border.BitmapEffect>
    </Border>
    <Border Height="100" Width="100" Background="blue" Panel.ZIndex="0">
    </Border>
</StackPanel>

O puede utilizar StackPanel.SetZIndex(object, value) si quisiera hacerlo desde código.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top