How to make my WPF button keep shining

chenyuhao88
chenyuhao88 used Ask the Experts™
on
Dear All,

The attached code is style of the button. When moving mouse over the button it will be shining.

My question is: how to make the button always keep shining, even if I don't touch the mouse. (for example the button itself will keep shining every X seconds...)

Thanks heaps!

<Style x:Key="aquaButton" TargetType="Button">
        <Setter Property="FontWeight" Value="UltraBold"/>
        <Setter Property="Foreground" Value="#B3000000"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="Button">
                    <Grid>
                        <Ellipse x:Name="backgroundGlow" Fill="Yellow"/>
                        <Ellipse x:Name="outterGlow" Fill="Yellow" Opacity="0">
                            <Ellipse.BitmapEffect>
                                <OuterGlowBitmapEffect GlowColor="Aqua" GlowSize="10"/>
                            </Ellipse.BitmapEffect>
                        </Ellipse>
                        <Ellipse x:Name="mainButton" Fill="Blue" Opacity="0.85"/>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="1"/>
                        <Ellipse x:Name="shine" Opacity="1">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,-0.1" EndPoint="0,1">
                                    <GradientStop Color="White" Offset="0"/>
                                    <GradientStop Color="White" Offset="0.1"/>
                                    <GradientStop Color="Transparent" Offset="0.5"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <Ellipse x:Name="shadow" Opacity="0.50">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                    <GradientStop Color="#FF000337" Offset="0"/>
                                    <GradientStop Color="#FF000337" Offset="0.2"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <Ellipse x:Name="buttonBorder"  Stroke="#FF706CEA" StrokeThickness="2"/>
                        <Ellipse x:Name="buttonOutline" Stroke="DarkBlue" StrokeThickness="1"/>
                        <Ellipse x:Name="hoverShine" Opacity="0">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="White" Offset="0"/>
                                    <GradientStop Color="White" Offset="0.1"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Button.IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="hoverShine"
                                    Storyboard.TargetProperty="Opacity"
                                    To="0.40"
                                    Duration="0:0:0.1"/>
                                        <DoubleAnimation Storyboard.TargetName="outterGlow"
                                     Storyboard.TargetProperty="Opacity"
                                     To="1"
                                     Duration="0:0:0.1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="hoverShine"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0"
                                        Duration="0:0:0.25"/>
                                        <DoubleAnimation Storyboard.TargetName="outterGlow"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0"
                                        Duration="0:0:0.25"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Button.IsMouseOver" Value="True"/>
                                <Condition Property="Button.IsPressed" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter TargetName="shine" Property="Opacity" Value="0.85"/>
                            <Setter TargetName="shadow" Property="Opacity" Value="0.85"/>
                            <MultiTrigger.EnterActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="hoverShine"
                                         Storyboard.TargetProperty="Opacity"                                         
                                         To="0"
                                         Duration="0:0:0.1"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.EnterActions>
                            <MultiTrigger.ExitActions>
                                <BeginStoryboard>
                                    <Storyboard>
                                        <DoubleAnimation Storyboard.TargetName="hoverShine"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0.40"
                                        Duration="0:0:0.25"/>
                                    </Storyboard>
                                </BeginStoryboard>
                            </MultiTrigger.ExitActions>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
I have not tested it but it should do the work, just correct the possible synthax mistakes. You can then start the animation by calling the storyboard within code.

ie:
private void button_Loaded(object sender, RoutedEventArgs e)
{
    ShowButtonAnimation.Begin();
}
<Style x:Key="aquaButton" TargetType="Button">
        <Setter Property="FontWeight" Value="UltraBold"/>
        <Setter Property="Foreground" Value="#B3000000"/>
        <Setter Property="Template">
            <Setter.Value>
		<ControlTemplate.Resources>
                        <Storyboard x:Key="ShowButtonAnimation" RepeatBehavior="Forever" BeginTime="0:0:10">
                            <DoubleAnimation Storyboard.TargetName="hoverShine"
                                    Storyboard.TargetProperty="Opacity"
                                    To="0.40"
				    AutoReverse="True" 
                                    Duration="0:0:0.1"/>
                            <DoubleAnimation Storyboard.TargetName="outterGlow"
                                     Storyboard.TargetProperty="Opacity"
                                     To="1"
				     AutoReverse="True"
                                     Duration="0:0:0.1"/>
                        </Storyboard>
                    </ControlTemplate.Resources>
                <ControlTemplate x:Name="ButtonShiner" TargetType="Button">
                    <Grid>
                        <Ellipse x:Name="backgroundGlow" Fill="Yellow"/>
                        <Ellipse x:Name="outterGlow" Fill="Yellow" Opacity="0">
                            <Ellipse.BitmapEffect>
                                <OuterGlowBitmapEffect GlowColor="Aqua" GlowSize="10"/>
                            </Ellipse.BitmapEffect>
                        </Ellipse>
                        <Ellipse x:Name="mainButton" Fill="Blue" Opacity="0.85"/>
                        <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="1"/>
                        <Ellipse x:Name="shine" Opacity="1">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,-0.1" EndPoint="0,1">
                                    <GradientStop Color="White" Offset="0"/>
                                    <GradientStop Color="White" Offset="0.1"/>
                                    <GradientStop Color="Transparent" Offset="0.5"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <Ellipse x:Name="shadow" Opacity="0.50">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                    <GradientStop Color="#FF000337" Offset="0"/>
                                    <GradientStop Color="#FF000337" Offset="0.2"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                        <Ellipse x:Name="buttonBorder"  Stroke="#FF706CEA" StrokeThickness="2"/>
                        <Ellipse x:Name="buttonOutline" Stroke="DarkBlue" StrokeThickness="1"/>
                        <Ellipse x:Name="hoverShine" Opacity="0">
                            <Ellipse.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientStop Color="White" Offset="0"/>
                                    <GradientStop Color="White" Offset="0.1"/>
                                    <GradientStop Color="Transparent" Offset="1"/>
                                </LinearGradientBrush>
                            </Ellipse.Fill>
                        </Ellipse>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

Open in new window

Author

Commented:
Hi Toony06,

There are 2 issues:


1, It seems the attached code need to be within  <ControlTemplate x:Name="ButtonShiner" TargetType="Button">. Is it true?


2, I still get compilation error for: ShowButtonAnimation.Begin();


Thanks again!




<ControlTemplate.Resources>
                        <Storyboard x:Key="ShowButtonAnimation" RepeatBehavior="Forever" BeginTime="0:0:10">
                            <DoubleAnimation Storyboard.TargetName="hoverShine"
                                        Storyboard.TargetProperty="Opacity"
                                        To="0.40"
				        AutoReverse="True" 
                                        Duration="0:0:0.1"/>
                            <DoubleAnimation Storyboard.TargetName="outterGlow"
                                         Storyboard.TargetProperty="Opacity"
                                         To="1"
				         AutoReverse="True"
                                         Duration="0:0:0.1"/>
                        </Storyboard>
                    </ControlTemplate.Resources>

Open in new window

Aaron JabamaniTechnical Architect

Commented:
Below code is working...not seeing any shining though
<Window x:Class="sqlce.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        <Style x:Key="aquaButton" TargetType="Button">
            <Setter Property="FontWeight" Value="UltraBold"/>
            <Setter Property="Foreground" Value="#B3000000"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate x:Name="ButtonShiner" TargetType="Button">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="ShowButtonAnimation" RepeatBehavior="Forever" BeginTime="0:0:10">
                                <DoubleAnimation Storyboard.TargetName="hoverShine"
                                    Storyboard.TargetProperty="Opacity"
                                    To="0.40"
				    AutoReverse="True" 
                                    Duration="0:0:0.1"/>
                                <DoubleAnimation Storyboard.TargetName="outterGlow"
                                     Storyboard.TargetProperty="Opacity"
                                     To="1"
				     AutoReverse="True"
                                     Duration="0:0:0.1"/>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Grid>
                            <Ellipse x:Name="backgroundGlow" Fill="Yellow"/>
                            <Ellipse x:Name="outterGlow" Fill="Yellow" Opacity="0">
                                <Ellipse.BitmapEffect>
                                    <OuterGlowBitmapEffect GlowColor="Aqua" GlowSize="10"/>
                                </Ellipse.BitmapEffect>
                            </Ellipse>
                            <Ellipse x:Name="mainButton" Fill="Blue" Opacity="0.85"/>
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="1"/>
                            <Ellipse x:Name="shine" Opacity="1">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,-0.1" EndPoint="0,1">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="White" Offset="0.1"/>
                                        <GradientStop Color="Transparent" Offset="0.5"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="shadow" Opacity="0.50">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                        <GradientStop Color="#FF000337" Offset="0"/>
                                        <GradientStop Color="#FF000337" Offset="0.2"/>
                                        <GradientStop Color="Transparent" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="buttonBorder"  Stroke="#FF706CEA" StrokeThickness="2"/>
                            <Ellipse x:Name="buttonOutline" Stroke="DarkBlue" StrokeThickness="1"/>
                            <Ellipse x:Name="hoverShine" Opacity="0">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="White" Offset="0.1"/>
                                        <GradientStop Color="Transparent" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <MultiTrigger>
                                <MultiTrigger.Conditions>
                                    <Condition Property="Button.IsVisible" Value="True"/>
                                </MultiTrigger.Conditions>
                                <Setter TargetName="shine" Property="Opacity" Value="0.85"/>
                                <Setter TargetName="shadow" Property="Opacity" Value="0.85"/>
                                <MultiTrigger.EnterActions>
                                    <BeginStoryboard>
                                        <Storyboard>
                                            <DoubleAnimation Storyboard.TargetName="hoverShine"
                                    Storyboard.TargetProperty="Opacity"
                                    To="0.15"
                                    Duration="0:0:5"/>
                                            <DoubleAnimation Storyboard.TargetName="outterGlow"
                                     Storyboard.TargetProperty="Opacity"
                                     To="1"
                                     Duration="0:0:10"/>
                                        </Storyboard>
                                    </BeginStoryboard>
                                </MultiTrigger.EnterActions>
                                

                            </MultiTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
       
    </Window.Resources>
    <Grid>
        <Button  Width="100" Height="100" Style="{StaticResource ResourceKey=aquaButton}" >
        </Button>
    </Grid>
</Window>

Open in new window

Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

Commented:
Sorry about that, as I tought there were errors in the code. I tested it and I came with a new solution that doesn't involve external storyboard start. The following code work perfectly and the button shine every 3 seconds for 0.3 seconds.
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        
        <Style x:Key="aquaButton" TargetType="Button">
            <Setter Property="FontWeight" Value="UltraBold"/>
            <Setter Property="Foreground" Value="#B3000000"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate x:Name="ButtonShiner" TargetType="Button">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="ShowButtonAnimation" RepeatBehavior="Forever">
                                <DoubleAnimation Storyboard.TargetName="hoverShine"
                                    Storyboard.TargetProperty="(UIElement.Opacity)"
                                    To="0.40"
				                    AutoReverse="True" BeginTime="0:0:3"
                                    Duration="0:0:0.3"/>
                                <DoubleAnimation Storyboard.TargetName="outterGlow"
                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                     To="1"
				                     AutoReverse="True" BeginTime="0:0:3"
                                     Duration="0:0:0.3"/>
                                <DoubleAnimation Storyboard.TargetName="shine"
                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                     To="0.85"
				                     AutoReverse="True" BeginTime="0:0:3"
                                     Duration="0:0:0.3"/>
                                <DoubleAnimation Storyboard.TargetName="shadow"
                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                     To="0.85"
				                     AutoReverse="True" BeginTime="0:0:3"
                                     Duration="0:0:0.3"/>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Grid>
                            <Ellipse x:Name="backgroundGlow" Fill="Yellow"/>
                            <Ellipse x:Name="outterGlow" Fill="Yellow" Opacity="0">
                                <Ellipse.BitmapEffect>
                                    <OuterGlowBitmapEffect GlowColor="Aqua" GlowSize="10"/>
                                </Ellipse.BitmapEffect>
                            </Ellipse>
                            <Ellipse x:Name="mainButton" Fill="Blue" Opacity="0.85"/>
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="1"/>
                            <Ellipse x:Name="shine" Opacity="1">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,-0.1" EndPoint="0,1">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="White" Offset="0.1"/>
                                        <GradientStop Color="Transparent" Offset="0.5"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="shadow" Opacity="0.50">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                        <GradientStop Color="#FF000337" Offset="0"/>
                                        <GradientStop Color="#FF000337" Offset="0.2"/>
                                        <GradientStop Color="Transparent" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="buttonBorder"  Stroke="#FF706CEA" StrokeThickness="2"/>
                            <Ellipse x:Name="buttonOutline" Stroke="DarkBlue" StrokeThickness="1"/>
                            <Ellipse x:Name="hoverShine" Opacity="0">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="White" Offset="0.1"/>
                                        <GradientStop Color="Transparent" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                        </Grid>
                        <ControlTemplate.Triggers>
                            <EventTrigger RoutedEvent="Loaded">
                                <EventTrigger.Actions>
                                    <BeginStoryboard x:Name="ShowMouseOver_BeginStoryboard" Storyboard="{StaticResource ShowButtonAnimation}"/>
                                </EventTrigger.Actions>
                            </EventTrigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>
    <Grid>
        <Button Width="100" Height="100" Style="{StaticResource ResourceKey=aquaButton}" />
    </Grid>

</Window>

Open in new window

Author

Commented:
Hi Toony06,

That's fantastic!

Just a final question: when I apply this style to a disabled button, it also shines.

How could I set this animation to enabled button only?

Thanks again!!
Commented:
Like so:
<Window x:Class="WpfApplication1.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Window.Resources>
        
        <Style x:Key="aquaButton" TargetType="Button">
            <Setter Property="FontWeight" Value="UltraBold"/>
            <Setter Property="Foreground" Value="#B3000000"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate x:Name="ButtonShiner" TargetType="Button">
                        <ControlTemplate.Resources>
                            <Storyboard x:Key="ShowButtonAnimation" RepeatBehavior="Forever">
                                <DoubleAnimation Storyboard.TargetName="hoverShine"
                                    Storyboard.TargetProperty="(UIElement.Opacity)"
                                    To="0.40"
				                    AutoReverse="True" BeginTime="0:0:3"
                                    Duration="0:0:0.3"/>
                                <DoubleAnimation Storyboard.TargetName="outterGlow"
                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                     To="1"
				                     AutoReverse="True" BeginTime="0:0:3"
                                     Duration="0:0:0.3"/>
                                <DoubleAnimation Storyboard.TargetName="shine"
                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                     To="0.85"
				                     AutoReverse="True" BeginTime="0:0:3"
                                     Duration="0:0:0.3"/>
                                <DoubleAnimation Storyboard.TargetName="shadow"
                                     Storyboard.TargetProperty="(UIElement.Opacity)"
                                     To="0.85"
				                     AutoReverse="True" BeginTime="0:0:3"
                                     Duration="0:0:0.3"/>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Grid>
                            <Ellipse x:Name="backgroundGlow" Fill="Yellow"/>
                            <Ellipse x:Name="outterGlow" Fill="Yellow" Opacity="0">
                                <Ellipse.BitmapEffect>
                                    <OuterGlowBitmapEffect GlowColor="Aqua" GlowSize="10"/>
                                </Ellipse.BitmapEffect>
                            </Ellipse>
                            <Ellipse x:Name="mainButton" Fill="Blue" Opacity="0.85"/>
                            <ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" Panel.ZIndex="1"/>
                            <Ellipse x:Name="shine" Opacity="1">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,-0.1" EndPoint="0,1">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="White" Offset="0.1"/>
                                        <GradientStop Color="Transparent" Offset="0.5"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="shadow" Opacity="0.50">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,1" EndPoint="0,0">
                                        <GradientStop Color="#FF000337" Offset="0"/>
                                        <GradientStop Color="#FF000337" Offset="0.2"/>
                                        <GradientStop Color="Transparent" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                            <Ellipse x:Name="buttonBorder"  Stroke="#FF706CEA" StrokeThickness="2"/>
                            <Ellipse x:Name="buttonOutline" Stroke="DarkBlue" StrokeThickness="1"/>
                            <Ellipse x:Name="hoverShine" Opacity="0">
                                <Ellipse.Fill>
                                    <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                        <GradientStop Color="White" Offset="0"/>
                                        <GradientStop Color="White" Offset="0.1"/>
                                        <GradientStop Color="Transparent" Offset="1"/>
                                    </LinearGradientBrush>
                                </Ellipse.Fill>
                            </Ellipse>
                        </Grid>
                        <ControlTemplate.Triggers> 
                            <Trigger Property="IsEnabled" Value="True">
                                <Trigger.EnterActions>
                                    <BeginStoryboard x:Name="ShowButtonAnimationStart" Storyboard="{StaticResource ShowButtonAnimation}"/>
                                </Trigger.EnterActions>
                                <Trigger.ExitActions>
                                    <StopStoryboard BeginStoryboardName="ShowButtonAnimationStart"/>
                                </Trigger.ExitActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Window.Resources>
    <Grid>
        <Button Width="100" Height="100" Style="{StaticResource ResourceKey=aquaButton}" Name="ShinyButton" />
    </Grid>

</Window>

Open in new window

Author

Commented:
Thanks a lot!!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial