1

GridSplitter横型と縦型で違う背景を設定したいです。これは、線形グラデーションがあり、グリッド スプリッターの配置に応じて 90 度回転させる必要があるためです。

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type GridSplitter}">
        <Setter Property="Background" Value="Red" /> <!-- How to get this red applied to only Vertical for instance? -->
    </Style>
</ResourceDictionary>

問題は、垂直スプリッターと水平スプリッターを別々にターゲットにするにはどうすればよいかということです。

4

2 に答える 2

3

Style.Triggersセッターを条件付きで適用するために使用します。

于 2012-04-15T17:26:26.773 に答える
1

さて、私はそれを得たように見えます:

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Style TargetType="{x:Type GridSplitter}">
        <Style.Triggers>
            <Trigger Property="VerticalAlignment" Value="Stretch">
                <Setter Property="Background" Value="#F7F7F7" />
            </Trigger>

            <Trigger Property="HorizontalAlignment" Value="Stretch">
                <Setter Property="Background" Value="red" />
            </Trigger>
        </Style.Triggers>
    </Style>
</ResourceDictionary>
于 2012-04-15T17:35:54.527 に答える