Skip to main content

Answered Question Move Canvas 50px right everytime on mouse Click with C# and XAMLRSS Feed

(0)

tjcombo
tjcombo

Member

Member

29 points

88 Posts

Move Canvas 50px right everytime on mouse Click with C# and XAML

I need to move a Canvas1 50px right everytime Button1 is clicked. I need to do it through C# and XAML without storyboard ?

Different day, same thing.

swildermuth
swildermuth

Star

Star

8320 points

1,546 Posts

Answered Question

Re: Move Canvas 50px right everytime on mouse Click with C# and XAML

Use a TranslateTransform.

<Canvas ...>
  <Canvas.RenderTransform>
    <TranslateTransform x:Name="translation" />
  </Canvas.RenderTransform>
</Canvas>

void OnClick(...)
{
  translation.X += 50;
}

 

(If this has answered your question, "Mark as Answer")

Shawn Wildermuth
C# MVP, MCSD, Speaker and Author

Silverlight 3 Workshop
Miami, FL: Oct 12-14th
Portlant, OR: Dec 2-4th
Atlanta, GA: Dec 7-9th
http://silverlight-tour.com

tjcombo
tjcombo

Member

Member

29 points

88 Posts

Re: Re: Move Canvas 50px right everytime on mouse Click with C# and XAML

RESPECT! Thanks alot brother!

Different day, same thing.
  • Unanswered Question
  • Answered Question
  • Announcement