Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6025655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T04:19:55+00:00 2026-05-23T04:19:55+00:00

Here is some class I got : <Style x:Key=BoutonMenu TargetType={x:Type Button}> <Setter Property=SnapsToDevicePixels Value=True/>

  • 0

Here is some class I got :

<Style x:Key="BoutonMenu" TargetType="{x:Type Button}">
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="OverridesDefaultStyle" Value="True"/>
    <Setter Property="Margin" Value="5,5,5,5"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type Button}">
                <ControlTemplate.Resources>
                    <Storyboard x:Key="BtnHover" AutoReverse="False" RepeatBehavior="Forever">
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="contentPresenter">
                            <EasingDoubleKeyFrame KeyTime="0:0:2" Value="-1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:4" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                    <Storyboard x:Key="BtnClick" AutoReverse="False">
                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="border">
                            <EasingPointKeyFrame KeyTime="0:0:0.1" Value="0.5,0.5"/>
                            <EasingPointKeyFrame KeyTime="0:0:0.15" Value="0.5,0.5"/>
                            <EasingPointKeyFrame KeyTime="0:0:0.25" Value="0.5,0.5"/>
                            <EasingPointKeyFrame KeyTime="0:0:0.4" Value="0.5,0.5"/>
                            <EasingPointKeyFrame KeyTime="0:0:0.6" Value="0.5,0.5"/>
                            <EasingPointKeyFrame KeyTime="0:0:1" Value="0.5,0.5"/>
                        </PointAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="border">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="-1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.15" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.25" Value="-1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="-1"/>
                            <EasingDoubleKeyFrame KeyTime="0:0:1" Value="1"/>
                        </DoubleAnimationUsingKeyFrames>
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle">
                            <EasingColorKeyFrame KeyTime="0:0:1" Value="#FF337641"/>
                        </ColorAnimationUsingKeyFrames>
                    </Storyboard>
                    <Storyboard x:Key="BtnRevert">
                        <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="(Shape.Fill).(SolidColorBrush.Color)" Storyboard.TargetName="rectangle">
                            <EasingColorKeyFrame KeyTime="0" Value="#FF337641"/>
                            <EasingColorKeyFrame KeyTime="0:0:0.5" Value="Black"/>
                        </ColorAnimationUsingKeyFrames>
                        <PointAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransformOrigin)" Storyboard.TargetName="border">
                            <EasingPointKeyFrame KeyTime="0:0:0.5" Value="0.5,0.5"/>
                        </PointAnimationUsingKeyFrames>
                        <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="border">
                            <EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="-1"/>
                        </DoubleAnimationUsingKeyFrames>
                    </Storyboard>
                </ControlTemplate.Resources>
                <Border x:Name="border" BorderBrush="#FF000000" Background="#FF000000" BorderThickness="0" CornerRadius="20" Opacity="1" >
                    <Border.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform/>
                            <SkewTransform/>
                            <RotateTransform/>
                            <TranslateTransform/>
                        </TransformGroup>
                    </Border.RenderTransform>
                    <Grid x:Name="grid">
                        <Border x:Name="mask" Background="White" CornerRadius="20"/>
                        <!-- Background Layer -->
                        <Grid x:Name="grid1">
                            <Grid.OpacityMask>
                                <VisualBrush Visual="{Binding ElementName=mask}"/>
                            </Grid.OpacityMask>
                            <Rectangle x:Name="rectangle" Fill="#FF000000" >
                                <Rectangle.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </Rectangle.RenderTransform>
                            </Rectangle>
                            <Rectangle x:Name="RefractionLayer">
                                <Rectangle.Fill>
                                    <RadialGradientBrush GradientOrigin="0.496,1.052">
                                        <RadialGradientBrush.RelativeTransform>
                                            <TransformGroup>
                                                <ScaleTransform CenterX="0.5" CenterY="0.5" ScaleX="1.5" ScaleY="1.5"/>
                                                <TranslateTransform X="0.02" Y="0.3"/>
                                            </TransformGroup>
                                        </RadialGradientBrush.RelativeTransform>
                                        <GradientStop Offset="0.819" Color="#00000000"/>
                                        <GradientStop Color="#FF020000" Offset="0.187"/>
                                    </RadialGradientBrush>
                                </Rectangle.Fill>
                            </Rectangle>

                            <ContentPresenter x:Name="contentPresenter" Margin="0,2,0,0" HorizontalAlignment="Stretch" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5">
                                <ContentPresenter.RenderTransform>
                                    <TransformGroup>
                                        <ScaleTransform/>
                                        <SkewTransform/>
                                        <RotateTransform/>
                                        <TranslateTransform/>
                                    </TransformGroup>
                                </ContentPresenter.RenderTransform>
                            </ContentPresenter>

                        </Grid>
                    </Grid>
                </Border>
                <ControlTemplate.Triggers>
                    <EventTrigger RoutedEvent="ButtonBase.Click">
                        <StopStoryboard BeginStoryboardName="BtnHover_BeginStoryboard"/>
                        <StopStoryboard BeginStoryboardName="BtnClick_BeginStoryboard"/>
                        <BeginStoryboard x:Name="BtnClick_BeginStoryboard" Storyboard="{StaticResource BtnClick}"/>
                    </EventTrigger>
                    <Trigger Property="IsMouseOver" Value="True">
                        <Trigger.ExitActions>
                            <RemoveStoryboard BeginStoryboardName="BtnHover_BeginStoryboard"/>
                        </Trigger.ExitActions>
                        <Trigger.EnterActions>
                            <BeginStoryboard x:Name="BtnHover_BeginStoryboard" Storyboard="{StaticResource BtnHover}"/>
                        </Trigger.EnterActions>
                    </Trigger>
                    <Trigger Property="IsPressed" Value="True"/>
                    <Trigger Property="IsEnabled" Value="False">
                        <Setter Property="Opacity" Value="0.25"/>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

As you can see, I have 3 different storyboards, two of which happen on specific triggers. I have a third one (BtnRevert) that I would like to start on demand. I can’t really seem to find how to do it. Is this possible, if yes how and if not how can I bypass that ?

Edit : So I tried this :

        Dim s As Storyboard = _oCurMenuBouton.Template.Resources("BtnRevert")
        s.Begin()

It seems to get the storyboard right, but now I get this :

No applicable name scope exists to resolve the name 'rectangle'.

It seems it does not recognize the storyboard has being the property of my button or at least the template. Is there any way to make it work ?

Got it to work ! Here is the answer

        Dim s As Storyboard = _oCurMenuBouton.Template.Resources("BtnRevert")
        s.Begin(_oCurMenuBouton,_oCurMenuBouton,Template)

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T04:19:56+00:00Added an answer on May 23, 2026 at 4:19 am

    just try this

      <Button Height="25"
                Margin="5"
                Style="{StaticResource BoutonMenu}" Click="Button_Click"></Button>
    

    in the code Behind

     private void Button_Click(object sender, RoutedEventArgs e)
        {
            var rButton = sender as Button;
            if (rButton != null)
            {
                Storyboard s = (Storyboard)rButton.Template.Resources["BtnRevert"];
            }  
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's some example code: class Obj attr :c, true def == that p '=='
If you want to associate some constant value with a class, here are two
I have this html: <div class=portlet-header> Company Information ... <button> some button here </button>
I got some sample code from the net here: http://www.javadb.com/sending-a-post-request-with-parameters-from-a-java-class That works fine. It
Here is some code: class Person def initialize(age) @age = age end def age
public class A { //some fields (may not only primitive types) and methods here}
What am I doing wrong here: class Helo { // main: generate some simple
Here is some simple Perl to count the number of times a value occurs
I've got this here wizard step with a couple of text boxes. For some
really strange situation I got here. I have 2 classes. @Entity public class CategoryData

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.