GridSplitter投影不适用

时间:2014-03-04 11:40:34

标签: c# wpf xaml mvvm

我对GridSplitter使用以下 Xaml ,我想添加一个 投影效果,但目前没有任何反应。关于我在这里缺少什么的想法?

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

1 个答案:

答案 0 :(得分:1)

我认为边距必须大于0才能有空间来绘制阴影......

如果适用,还可以考虑使用BlurRadius。

以下XAML Snippet按预期方式删除阴影......

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

度过美好的一天!