简体   繁体   English

GridSplitter投影不适用

[英]GridSplitter drop shadow are not applicable

I use the following Xaml for GridSplitter and I wanted to add a drop shadow effect to it, but currently nothing happens. 我将以下Xaml用于GridSplitter ,我想为其添加阴影效果,但是目前没有任何反应。 Any idea about what I'm missing here? 对我在这里想念的东西有任何想法吗?

<GridSplitter ResizeDirection="Rows"
              Width="700"
              Height="4px"
              HorizontalAlignment="Stretch"
              VerticalAlignment="Bottom"
              Background="#d9d9d9"
              Margin="0,0,0,0">
    <GridSplitter.Effect>
        <DropShadowEffect ShadowDepth="3"
                          Opacity="3"
                          Color="Black" />
    </GridSplitter.Effect>
</GridSplitter>

I assume that the margin must be more than 0 in order to have space where to draw the shadow... 我假设边距必须大于0才能有空间绘制阴影...

Consider also using of BlurRadius if applicable. 如果适用,还考虑使用BlurRadius。

Following XAML Snippet drops shadow as expected... 以下XAML代码段按预期投下阴影...

<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow"
        Width="525"
        Height="350">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
            <RowDefinition />
        </Grid.RowDefinitions>

        <GridSplitter Grid.Row="3"
                      Width="700"
                      Height="10"
                      Margin="30"
                      HorizontalAlignment="Stretch"
                      VerticalAlignment="Bottom"
                      Background="#d9d9d9"
                      ResizeDirection="Rows">
            <GridSplitter.Effect>
                <DropShadowEffect BlurRadius="3"
                                  Opacity="3"
                                  ShadowDepth="3"
                                  Color="Black" />
            </GridSplitter.Effect>

        </GridSplitter>

    </Grid>
   </Window>

Have a nice day! 祝你今天愉快!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM