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
반응형
그리드형(광고전용)
'C# > Silverlight' 카테고리의 다른 글
[C#/SILVERLIGHT] Storyboard 엘리먼트 : 사각형 움직이기 (0) | 2014.02.26 |
---|---|
[C#/SILVERLIGHT] Behavior 동적 추가하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] EventTrigger 엘리먼트 사용하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] Expression Blend 4 참조 사용하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] ItemsPanelTemplate 엘리먼트 사용하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] VisualStateManager 엘리먼트 사용하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] ResourceDictionary 엘리먼트 : MergedDictionaries 속성을 사용해 리소스 파일 병합하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] 리소스 구하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] Binding 태그 확장 : NotifyOnValidationError 속성과 BindingValidationError 이벤트 사용하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] Binding 태그 확장 : INotifyDataErrorInfo 인터페이스를 이용한 바인딩 에러 처리하기 (0) | 2014.02.26 |
[C#/SILVERLIGHT] Binding 태그 확장 : IDataErrorInfo 인터페이스를 이용한 바인딩 에러 처리하기 (0) | 2014.02.25 |
댓글을 달아 주세요