첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170
<Grid x:Name="grid"
    xmlns:sw="clr-namespace:System.Windows;assembly=System.Windows">
    <Grid.Resources>
        <ControlTemplate
            x:Key="ButtonControlTemplateKey"
            TargetType="Button">
            <Grid >
                <sw:VisualStateManager.VisualStateGroups>
                    <sw:VisualStateGroup x:Name="CommonStates">
                        <sw:VisualStateGroup.Transitions>
                            <sw:VisualTransition                  To="Normal"    GeneratedDuration="0:0:0.2" />
                            <sw:VisualTransition                  To="MouseOver" GeneratedDuration="0:0:1"   />
                            <sw:VisualTransition From="MouseOver" To="Pressed"   GeneratedDuration="0:0:0.5" />
                            <sw:VisualTransition                  To="Disabled"  GeneratedDuration="0:0:0"   />
                        </sw:VisualStateGroup.Transitions>
                        <sw:VisualState x:Name="Normal" />
                        <sw:VisualState x:Name="MouseOver">
                            <Storyboard>
                                <ColorAnimation
                                    Storyboard.TargetName="ellipseSolidColorBrush"
                                    Storyboard.TargetProperty="Color"
                                    To="Blue" />
                            </Storyboard>
                        </sw:VisualState>
                        <sw:VisualState x:Name="Pressed">
                            <Storyboard>
                                <ColorAnimation
                                    Storyboard.TargetName="ellipseSolidColorBrush"
                                    Storyboard.TargetProperty="Color"
                                    To="Red" />
                            </Storyboard>
                        </sw:VisualState>
                        <sw:VisualState x:Name="Disabled">
                            <Storyboard>
                                <ColorAnimation
                                    Storyboard.TargetName="ellipseSolidColorBrush"
                                    Storyboard.TargetProperty="Color"
                                    To="Gray" />
                            </Storyboard>
                        </sw:VisualState>
                    </sw:VisualStateGroup>
                </sw:VisualStateManager.VisualStateGroups>
                <Ellipse>
                    <Ellipse.Fill>
                        <SolidColorBrush
                            x:Name="ellipseSolidColorBrush"
                            Color="Gold" />
                    </Ellipse.Fill>
                </Ellipse>
                <ContentPresenter
                    x:Name="contentPresenter"
                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                    Margin="{TemplateBinding Padding}"
                    ContentTemplate="{TemplateBinding ContentTemplate}"
                    Content="{TemplateBinding Content}" />
            </Grid>
        </ControlTemplate>
    </Grid.Resources>
    <Button
        Width="100"
        Height="50"
        Template="{StaticResource ButtonControlTemplateKey}"
        Content="버튼" />
</Grid>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요