첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
728x90
반응형
728x170

■ Style 엘리먼트의 TargetType 속성을 사용해 버튼 스타일을 설정하는 방법을 보여준다.

TestProject.zip
다운로드

▶ MainWindow.xaml

<Window x:Class="TestProject.MainWindow"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="800"
    Height="600"
    Title="Style 엘리먼트 : TargetType 속성을 사용해 버튼 스타일 설정하기"
    FontFamily="나눔고딕코딩"
    FontSize="16">
    <Window.Resources>
        <Style TargetType="{x:Type Button}">
            <Setter Property="Margin"      Value="10"      />
            <Setter Property="BorderBrush" Value="Crimson" />
            <Setter Property="Background"  Value="Orange"  />
            <Setter Property="FontSize"    Value="20"      />
            <Setter Property="FontWeight"  Value="Bold"    />
        </Style>
    </Window.Resources>
    <StackPanel
        HorizontalAlignment="Center"
        VerticalAlignment="Center">
        <Button
            Margin="10"
            Width="100"
            Height="30">
            테스트
        </Button>
        <Button
            Margin="10"
            Width="100"
            Height="30">
            테스트
        </Button>
        <Button
            Margin="10"
            Width="100"
            Height="30">
            테스트
        </Button>
    </StackPanel>
</Window>
728x90
반응형
그리드형(광고전용)
Posted by icodebroker

댓글을 달아 주세요