728x90
반응형
728x170
■ Style 엘리먼트의 TargetType 속성을 사용해 버튼 스타일을 설정하는 방법을 보여준다.
▶ 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
반응형
그리드형(광고전용)
'C# > WPF' 카테고리의 다른 글
[C#/WPF] Button 엘리먼트 : IsDefault 속성을 사용해 디폴트 확인 버튼 설정하기 (0) | 2014.01.28 |
---|---|
[C#/WPF] MessageBox 클래스 사용하기 (0) | 2014.01.28 |
[C#/WPF] TextBox 엘리먼트 : AcceptsTab 속성을 사용해 탭 문자 입력하기 (0) | 2014.01.28 |
[C#/WPF] TextBox 엘리먼트 : AcceptsReturn 속성을 사용해 멀티 라인 입력하기 (0) | 2014.01.28 |
[C#/WPF] TextBox 엘리먼트 : 스크롤 바 표시하기 (0) | 2014.01.28 |
[C#/WPF] Button 엘리먼트 : Template 속성 사용하기 (0) | 2014.01.27 |
[C#/WPF] ColorConverter 클래스 : ConvertFromString 정적 메소드를 사용해 색상 값에서 색상 구하기 (0) | 2014.01.27 |
[C#/WPF] DockPanel 엘리먼트 사용하기 (0) | 2014.01.27 |
[C#/WPF] Application 엘리먼트 사용하기 (0) | 2014.01.27 |
[C#/WPF] Window 엘리먼트 사용하기 (0) | 2014.01.27 |
댓글을 달아 주세요