■ Style 클래스 : BasedOn 속성을 사용해 스타일 상속하기

------------------------------------------------------------------------------------------------------------------------

<Style x:Key="CenterFrameworkElementStyleKey" TargetType="FrameworkElement">

    <Setter Property="HorizontalAlignment" Value="Center" />

    <Setter Property="VerticalAlignment"   Value="Center" />

</Style>

<Style x:Key="RainbowStyleTextBlockKey" TargetType="TextBlock" BasedOn="{StaticResource CenterFrameworkElementStyleKey}">

    <Setter Property="FontSize" Value="96" />

    <Setter Property="Foreground">

        <Setter.Value>

            <LinearGradientBrush>

                <GradientStop Offset="0" Color="Red" />

                <GradientStop Offset="1" Color="Blue" />

            </LinearGradientBrush>

        </Setter.Value>

    </Setter>

</Style>

------------------------------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG

댓글을 달아 주세요