Here's an example I made real quick to get you started. 

<Style TargetType="Button"
                x:Key="styleA">
            <Setter Property="Template">
               <Setter.Value>
                  <ControlTemplate TargetType="Button">
                     <Grid x:Name="RootElement"
                           Background="Transparent">
                        <Grid.Resources>
                           <Storyboard x:Key="MouseOver State">
                             
                              <DoubleAnimation Storyboard.TargetName="buttonScale"
                                               Storyboard.TargetProperty="ScaleX"
                                               To="1.2"
                                               Duration="00:00:00.25"/>
                              <DoubleAnimation Storyboard.TargetName="buttonScale"
                                               Storyboard.TargetProperty="ScaleY"
                                               To="1.2"
                                               Duration="00:00:00.25" />
                           </Storyboard>

                           <Storyboard x:Key="Normal State">

                              <DoubleAnimation Storyboard.TargetName="buttonScale"
                                               Storyboard.TargetProperty="ScaleX"
                                               To="1"
                                               Duration="00:00:00.25" />
                              <DoubleAnimation Storyboard.TargetName="buttonScale"
                                               Storyboard.TargetProperty="ScaleY"
                                               To="1"
                                               Duration="00:00:00.25" />
                           </Storyboard>
                          
                           <Storyboard x:Key="Pressed State">

                              <DoubleAnimation Storyboard.TargetName="buttonScale"
                                               Storyboard.TargetProperty="ScaleX"
                                               To="1.4"
                                               Duration="00:00:00.25" />
                              <DoubleAnimation Storyboard.TargetName="buttonScale"
                                               Storyboard.TargetProperty="ScaleY"
                                               To="1.4"
                                               Duration="00:00:00.25" />
                           </Storyboard>


                        </Grid.Resources>
                        <ContentPresenter Content="{TemplateBinding Content}"
                                          RenderTransformOrigin="0.5,0.5">
                           <ContentPresenter.RenderTransform>
                              <ScaleTransform x:Name="buttonScale" />
                           </ContentPresenter.RenderTransform>
                        </ContentPresenter>
                     </Grid>
                  </ControlTemplate>                 
               </Setter.Value>
              
            </Setter>
         </Style>

 You'll want to affect the content of the button to what you need, for example :

 <Button Width="100"
              x:Name="buttonTest"
              Style="{StaticResource styleA}"
              Click="buttonTest_Click">
         <StackPanel Orientation="Vertical">
            <Image Source="image1.jpg" />
            <TextBlock Text="Test 1" />
         </StackPanel>
      </Button>

Modify the storyboard states to reflect what you need for your RenderTransform etc...

 Hope this helps ! If it did, remember to mark the post as answered !

相关文章:

  • 2022-01-12
  • 2022-12-23
  • 2022-12-23
  • 2021-07-02
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-04
  • 2021-08-23
  • 2021-05-24
  • 2022-02-15
  • 2021-12-03
  • 2021-06-21
  • 2022-02-13
相关资源
相似解决方案