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 297315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T06:37:42+00:00 2026-05-12T06:37:42+00:00

I have created a WFP UserControl with some complex XAML (converted from SVG). It’s

  • 0

I have created a WFP UserControl with some complex XAML (converted from SVG). It’s basically a fancy button.

I would like to create an animation in the usercontrol’s XAML to “shift” it’s location by 4 pixels to the right and down, to simulate a click, and then have it pop back to its original location.

To me, this sounds like the first animation anyone would ever learn in WPF, but I’m having trouble finding a good example.

I have included the UserControl if anyone is interested.

<UserControl x:Class="PositionButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="50" Height="50">

<Canvas xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="svg2" Width="48.618" Height="44.289">
    <Canvas x:Name="Layer_1">
         <Path Fill="#FFFFCC00" Stroke="#FF000000" StrokeThickness="1.25" StrokeMiterLimit="4" x:Name="path3240" Canvas.Left="-47.7386" Canvas.Top="-164.9827" Data="M90.521734,187.00391A18.579054,18.415361,0,1,1,53.363626,187.00391A18.579054,18.415361,0,1,1,90.521734,187.00391z">
        </Path>
        <Path x:Name="path4635" RenderTransform="0.8722467,0,0,0.8722467,0,0" Canvas.Left="-38.5477" Canvas.Top="-141.0923" Data="M90.521734,187.00391A18.579054,18.415361,0,1,1,53.363626,187.00391A18.579054,18.415361,0,1,1,90.521734,187.00391z">
            <Path.Fill>
                <LinearGradientBrush StartPoint="61.433315,163.5455" EndPoint="83.765717,207.83496" ColorInterpolationMode="ScRgbLinearInterpolation" MappingMode="Absolute" SpreadMethod="Pad" Transform="Identity">
                    <GradientStop Color="#FFF9F9F9" Offset="0" />
                    <GradientStop Color="#00F9F9F9" Offset="1" />
                </LinearGradientBrush>
            </Path.Fill>
        </Path>
        <Path Fill="#FF000000" x:Name="text4651">
            <Path.Data>
                <PathGeometry FillRule="Nonzero">
                    <PathGeometry.Figures>
                        <PathFigure StartPoint="18.202721,31.924561" IsClosed="True">
                            <PathFigure.Segments>
                                <PolyLineSegment Points="13.89608,31.924561 18.779503,17.55542 17.125206,17.55542 18.095909,14.697998" />
                                <PolyBezierSegment Points="18.724808,14.698015 19.347163,14.429135 19.962975,13.891357 20.57877,13.353616 20.97326,12.829528 21.146446,12.319092" />
                                <PolyLineSegment Points="24.865196,12.319092 18.202721,31.924561" />
                            </PathFigure.Segments>
                        </PathFigure>
                        <PathFigure StartPoint="19.132408,31.924561" IsClosed="True">
                            <PathFigure.Segments>
                                <PolyLineSegment Points="25.794884,12.319092 30.867149,12.319092" />
                                <PolyBezierSegment Points="32.079376,12.319111 33.0384,12.594827 33.744225,13.14624 34.450019,13.697691 34.596992,14.579526 34.185143,15.791748" />
                                <LineSegment Point="33.260582,18.512451" />
                                <PolyBezierSegment Points="32.792876,19.888765 31.624501,20.859467 29.755455,21.424561 31.37499,21.862071 31.938384,22.805429 31.445641,24.254639" />
                                <LineSegment Point="30.154503,28.05542" />
                                <PolyBezierSegment Points="29.714713,29.349693 28.964043,30.318117 27.902489,30.960693 26.840916,31.603272 25.726802,31.924561 24.560143,31.924561" />
                                <LineSegment Point="19.132408,31.924561" />
                            </PathFigure.Segments>
                        </PathFigure>
                        <PathFigure StartPoint="28.963341,19.209717" IsClosed="True">
                            <PathFigure.Segments>
                                <LineSegment Point="30.097252,15.873779" />
                                <BezierSegment Point1="30.329092,15.190202" Point2="30.043977,14.848406" Point3="29.241905,14.848389" />
                                <LineSegment Point="27.40731,20.248779" />
                                <BezierSegment Point1="28.209384,20.248791" Point2="28.728061,19.902437" Point3="28.963341,19.209717" />
                                <LineSegment Point="28.963341,19.209717" />
                            </PathFigure.Segments>
                        </PathFigure>
                        <PathFigure StartPoint="25.850426,28.369873" IsClosed="True">
                            <PathFigure.Segments>
                                <LineSegment Point="27.537193,23.406982" />
                                <BezierSegment Point1="27.769036,22.723398" Point2="27.483921,22.381601" Point3="26.681847,22.381592" />
                                <LineSegment Point="24.294395,29.408936" />
                                <BezierSegment Point1="25.096472,29.408938" Point2="25.615149,29.062584" Point3="25.850426,28.369873" />
                                <LineSegment Point="25.850426,28.369873" />
                            </PathFigure.Segments>
                        </PathFigure>
                    </PathGeometry.Figures>
                </PathGeometry>
            </Path.Data>
        </Path>
    </Canvas>
</Canvas>

  • 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-12T06:37:43+00:00Added an answer on May 12, 2026 at 6:37 am

    Pavel is right on all counts. I have made some XAML that demonstrates his approach:

    <Window.Resources>
     <ControlTemplate x:Key="svgButton" TargetType="{x:Type Button}">
      <Canvas x:Name="svg2" Width="48.618" Height="44.289">
       <Canvas x:Name="Layer_1">
        <Path Fill="#FFFFCC00" Stroke="#FF000000" StrokeThickness="1.25" StrokeMiterLimit="4" x:Name="path3240" Canvas.Left="-47.7386" Canvas.Top="-164.9827" Data="M90.521734,187.00391A18.579054,18.415361,0,1,1,53.363626,187.00391A18.579054,18.415361,0,1,1,90.521734,187.00391z">
        </Path>
        <Path x:Name="path4635" RenderTransform="0.8722467,0,0,0.8722467,0,0" Canvas.Left="-38.5477" Canvas.Top="-141.0923" Data="M90.521734,187.00391A18.579054,18.415361,0,1,1,53.363626,187.00391A18.579054,18.415361,0,1,1,90.521734,187.00391z">
         <Path.Fill>
          <LinearGradientBrush StartPoint="61.433315,163.5455" EndPoint="83.765717,207.83496" ColorInterpolationMode="ScRgbLinearInterpolation" MappingMode="Absolute" SpreadMethod="Pad" Transform="Identity">
           <GradientStop Color="#FFF9F9F9" Offset="0" />
           <GradientStop Color="#00F9F9F9" Offset="1" />
          </LinearGradientBrush>
         </Path.Fill>
        </Path>
        <Path Fill="#FF000000" x:Name="text4651">
         <Path.Data>
          <PathGeometry FillRule="Nonzero">
           <PathGeometry.Figures>
            <PathFigure StartPoint="18.202721,31.924561" IsClosed="True">
             <PathFigure.Segments>
              <PolyLineSegment Points="13.89608,31.924561 18.779503,17.55542 17.125206,17.55542 18.095909,14.697998" />
              <PolyBezierSegment Points="18.724808,14.698015 19.347163,14.429135 19.962975,13.891357 20.57877,13.353616 20.97326,12.829528 21.146446,12.319092" />
              <PolyLineSegment Points="24.865196,12.319092 18.202721,31.924561" />
             </PathFigure.Segments>
            </PathFigure>
            <PathFigure StartPoint="19.132408,31.924561" IsClosed="True">
             <PathFigure.Segments>
              <PolyLineSegment Points="25.794884,12.319092 30.867149,12.319092" />
              <PolyBezierSegment Points="32.079376,12.319111 33.0384,12.594827 33.744225,13.14624 34.450019,13.697691 34.596992,14.579526 34.185143,15.791748" />
              <LineSegment Point="33.260582,18.512451" />
              <PolyBezierSegment Points="32.792876,19.888765 31.624501,20.859467 29.755455,21.424561 31.37499,21.862071 31.938384,22.805429 31.445641,24.254639" />
              <LineSegment Point="30.154503,28.05542" />
              <PolyBezierSegment Points="29.714713,29.349693 28.964043,30.318117 27.902489,30.960693 26.840916,31.603272 25.726802,31.924561 24.560143,31.924561" />
              <LineSegment Point="19.132408,31.924561" />
             </PathFigure.Segments>
            </PathFigure>
            <PathFigure StartPoint="28.963341,19.209717" IsClosed="True">
             <PathFigure.Segments>
              <LineSegment Point="30.097252,15.873779" />
              <BezierSegment Point1="30.329092,15.190202" Point2="30.043977,14.848406" Point3="29.241905,14.848389" />
              <LineSegment Point="27.40731,20.248779" />
              <BezierSegment Point1="28.209384,20.248791" Point2="28.728061,19.902437" Point3="28.963341,19.209717" />
              <LineSegment Point="28.963341,19.209717" />
             </PathFigure.Segments>
            </PathFigure>
            <PathFigure StartPoint="25.850426,28.369873" IsClosed="True">
             <PathFigure.Segments>
              <LineSegment Point="27.537193,23.406982" />
               <BezierSegment Point1="27.769036,22.723398" Point2="27.483921,22.381601" Point3="26.681847,22.381592" />
               <LineSegment Point="24.294395,29.408936" />
               <BezierSegment Point1="25.096472,29.408938" Point2="25.615149,29.062584" Point3="25.850426,28.369873" />
               <LineSegment Point="25.850426,28.369873" />
              </PathFigure.Segments>
             </PathFigure>
            </PathGeometry.Figures>
           </PathGeometry>
          </Path.Data>
         </Path>
        </Canvas>
       </Canvas>
       <ControlTemplate.Triggers>
        <Trigger Property="Button.IsPressed" Value="True">
         <Setter Property="RenderTransform">
          <Setter.Value>
           <TranslateTransform X="1" Y="1"/>
          </Setter.Value>
         </Setter>
        </Trigger>
       </ControlTemplate.Triggers>
      </ControlTemplate>
     </Window.Resources>
    
     <Button Template="{StaticResource svgButton}"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a module in Magento which takes certain views from customers about
I have created some forms using zendframework on my local machine that send the
Have created a custom navigation menu in wordpress that has some pages and some
I have created some Load Tests to an HTTP server which consist of simple
I have created a bucket on Amazon S3 and I kept some images in
I have created an Scene in Qt where i took the an image from
I have created a UserControl that has a ListView in it. The ListView is
I have created a few small flash widgets that stream .mp3 audio from an
I have created a webservice in .net 2.0, C#. I need to log some
I have created a Scrollviewer in WP7, which harbors 3 usercontrol, each one of

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.