트리거(Triggers)
.NET프로그래밍/Silverlight 3.0 2009. 12. 7. 11:23 |"새 프로젝트"만들기로 "RiaTriggers"프로젝트를 만든다.
그리고 아래 그림과 같이 참조추가 한 후, [MainPage.xaml]소스코드에서 "xmlns"부분을 2줄 추가하고 아래와 같이 코드를 작성한다 .
[MainPage.xaml]
<UserControl x:Class="RiaTriggers.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:ic="clr-namespace:Microsoft.Expression.Interactivity.Core;assembly=Microsoft.Expression.Interactions"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="400">
<Grid x:Name="LayoutRoot" Background="White">
<Button x:Name="btn" Content="버튼">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<ic:ChangePropertyAction TargetName="btn" PropertyName="Background">
<ic:ChangePropertyAction.Value>
<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
<GradientStop Color="Black" Offset="0"/>
<GradientStop Color="Red" Offset="1"/>
</LinearGradientBrush>
</ic:ChangePropertyAction.Value>
</ic:ChangePropertyAction>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
</Grid>
</UserControl>
'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글
GoToStateAction - 컨트롤 상태 변경 액션 (0) | 2009.12.07 |
---|---|
ChangedPropertyAction (0) | 2009.12.07 |
VisualStateManager 클래스 (0) | 2009.12.07 |
키프레임 (KeyFrame) - EasingDoubleKeyFrame (여러가지 모양을 단어화(함수화)) (0) | 2009.12.04 |
키프레임 (KeyFrame) - SplineColorKeyFrame (속도가변곡선, 보간법, 비선형) (0) | 2009.12.04 |