1

StackPanel の最初のコントロールの影を 2 番目のコントロールの上に表示する方法はありますか? 私はこれに問題があります、写真を見てください!
代替テキスト http://img2.imageshack.us/img2/7073/issuef.png
コード サンプル:

 <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>
4

1 に答える 1

5

各 Border で使用Panel.ZIndex="0"して、アイテムの z オーダーを 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>

またはStackPanel.SetZIndex(object, value)、コードから実行したい場合に使用できます。

于 2009-10-15T11:45:47.183 に答える