Windows 8 Xaml Object.Trigger not exist (Button.Triggers)
There is no <object.Triggers> in Windows 8 xaml. instead you can use <VisualState >
This code perform the button.trigger functionality in Windows 8
<ControlTemplate TargetType=”Button”>
<Grid Width=”50″ Height=”50″ >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name=”CommonStates”>
<VisualStateGroup.Transitions>
<VisualTransition To=”PointerOver“
GeneratedDuration=”0:0:0.5″/>
</VisualStateGroup.Transitions>
<VisualState x:Name=”Normal” />
<VisualState x:Name=”PointerOver”>
<Storyboard>
<ColorAnimation Storyboard.TargetName=”ButtonBrush”
Storyboard.TargetProperty=”Color” To=”Red” />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.Background>
<SolidColorBrush x:Name=”ButtonBrush” Color=”Green”/>
</Grid.Background>
</Grid>
</ControlTemplate>
This is the full code
<Page.Resources>
<Style x:Key=”AddButton1″ TargetType=”Button”>
<Setter Property=”Template”>
<Setter.Value>
<ControlTemplate TargetType=”Button”>
<Grid Width=”50″ Height=”50″ >
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name=”CommonStates”>
<VisualStateGroup.Transitions>
<VisualTransition To=”PointerOver”
GeneratedDuration=”0:0:0.5″/>
</VisualStateGroup.Transitions>
<VisualState x:Name=”Normal” />
<VisualState x:Name=”PointerOver”>
<Storyboard>
<ColorAnimation Storyboard.TargetName=”ButtonBrush”
Storyboard.TargetProperty=”Color” To=”Red” />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid.Background>
<SolidColorBrush x:Name=”ButtonBrush” Color=”Green”/>
</Grid.Background>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Page.Resources>
<Grid Background=”{StaticResource ApplicationPageBackgroundThemeBrush}”>
<Button HorizontalAlignment=”Left” Margin=”434,88,0,0″ VerticalAlignment=”Top” Style=”{StaticResource AddButton1}” Content=”heeey”>
</Button>
</Grid>
I¡¯m impressed, I must say. Really not often do I encounter a blog that¡¯s both educative and entertaining, and let me tell you, you may have hit the nail on the head. Your thought is outstanding; the problem is one thing that not enough individuals are talking intelligently about. I¡¯m very glad that I stumbled throughout this in my seek for one thing regarding this.
Getting Homecoming Dresses
July 16, 2012 at 3:47 pm
magnificent issues altogether, you just received a new reader. What may you recommend in regards to your submit that you simply made some days in the past? Any positive?
http://www.CoolMobilePhone.net
Royce Perrault
July 19, 2012 at 4:44 pm
Thanks 🙂
Ahmed Maher Pasha
July 25, 2012 at 1:49 am