<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" media="screen" href="/App_Themes/default/rss.xslt"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:evnet="http://www.mscommunities.com/rssmodule/"><channel><title>Comment Feed for how to move Rectangle from left to right with wpf(c# code not with xaml) (Coffeehouse on Channel 9)</title><atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/forums/coffeehouse/260049-how-to-move-rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/rss/default.aspx" /><image><url>http://mschnlnine.vo.llnwd.net/d1/Dev/App_Themes/C9/images/feedimage.png</url><title>Comment Feed for how to move Rectangle from left to right with wpf(c# code not with xaml) (Coffeehouse on Channel 9)</title><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/</link></image><description>how to move Rectangle from left to right with wpf(c# code not with xaml)</description><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/</link><language>en-us</language><pubDate>Sun, 06 Jan 2008 20:32:01 GMT</pubDate><lastBuildDate>Sun, 06 Jan 2008 20:32:01 GMT</lastBuildDate><generator>EvNet (EvNet, Version=1.0.3608.3122, Culture=neutral, PublicKeyToken=null)</generator><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;evildictaitor wrote:&lt;/div&gt;&lt;div&gt;﻿&lt;blockquote&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://channel9.msdn.com/Themes/AlmostGlass/images/icon-quote.gif&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;ddl wrote:&lt;/strong&gt;&lt;i&gt;﻿hey &lt;br&gt;&lt;strong&gt;evildictaitor &lt;br&gt;&lt;/strong&gt;&lt;br&gt;he was n't asked your vista&amp;nbsp;OS source&amp;nbsp;which was developed by you&lt;img src="http://channel9.msdn.com/emoticons/emotion-4.gifborder="&gt;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;I developed all of the Vista codebase? News to me.&lt;br&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br&gt;&lt;br&gt;In your sleep, durr?&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376605</link><pubDate>Sun, 06 Jan 2008 20:32:01 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376605</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376605/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>evildictaitor wrote:﻿ddl wrote:﻿hey evildictaitor he was n't asked your vista&amp;nbsp;OS source&amp;nbsp;which was developed by youI developed all of the Vista codebase? News to me.In your sleep, durr?</evnet:previewtext><dc:creator>Lloyd Humphreys</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376605/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;ddl wrote:&lt;/div&gt;&lt;div&gt;﻿hey &lt;br&gt;&lt;strong&gt;evildictaitor &lt;br&gt;&lt;/strong&gt;&lt;br&gt;he was n't asked your vista&amp;nbsp;OS source&amp;nbsp;which was developed by you&lt;img src="http://channel9.msdn.com/emoticons/emotion-4.gifborder="&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br&gt;&lt;br&gt;I developed all of the Vista codebase? News to me.&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376598</link><pubDate>Sun, 06 Jan 2008 19:56:19 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376598</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376598/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>ddl wrote:﻿hey evildictaitor he was n't asked your vista&amp;nbsp;OS source&amp;nbsp;which was developed by youI developed all of the Vista codebase? News to me.</evnet:previewtext><dc:creator>evildictaitor</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376598/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>hey &lt;BR&gt;&lt;STRONG&gt;evildictaitor &lt;BR&gt;&lt;/STRONG&gt;&lt;BR&gt;he was n't asked your vista&amp;nbsp;OS source&amp;nbsp;which was developed by you:P&lt;BR&gt;he just asked your help &lt;BR&gt;if know answer please try to help other then :$&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;===========================&lt;BR&gt;&lt;BR&gt;ple try following code ::ven::[H]&lt;BR&gt;&lt;BR&gt;============================&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;
&lt;P&gt;NameScope.SetNameScope(this, new NameScope());&lt;/P&gt;
&lt;P&gt;RectangleGeometry myRectangleGeometry = new RectangleGeometry();&lt;/P&gt;
&lt;P&gt;myRectangleGeometry.Rect = new Rect(0, 200, 100, 100);&lt;/P&gt;
&lt;P&gt;// Assign the geometry a name so that&lt;/P&gt;
&lt;P&gt;// it can be targeted by a Storyboard.&lt;/P&gt;
&lt;P&gt;this.RegisterName(&lt;/P&gt;
&lt;P&gt;"MyAnimatedRectangleGeometry", myRectangleGeometry);&lt;/P&gt;
&lt;P&gt;Path myPath = new Path();&lt;/P&gt;
&lt;P&gt;myPath.Fill = Brushes.LemonChiffon;&lt;/P&gt;
&lt;P&gt;myPath.StrokeThickness = 1;&lt;/P&gt;
&lt;P&gt;myPath.Stroke = Brushes.Black;&lt;/P&gt;
&lt;P&gt;myPath.Data = myRectangleGeometry;&lt;/P&gt;
&lt;P&gt;RectAnimation myRectAnimation = new RectAnimation();&lt;/P&gt;
&lt;P&gt;myRectAnimation.Duration = TimeSpan.FromSeconds(2);&lt;/P&gt;
&lt;P&gt;myRectAnimation.FillBehavior = FillBehavior.HoldEnd;&lt;/P&gt;
&lt;P&gt;// Set the animation to repeat forever. &lt;/P&gt;
&lt;P&gt;myRectAnimation.RepeatBehavior = RepeatBehavior.Forever;&lt;/P&gt;
&lt;P&gt;// Set the From and To properties of the animation.&lt;/P&gt;
&lt;P&gt;myRectAnimation.From = new Rect(0, 200, 100, 100);&lt;/P&gt;
&lt;P&gt;myRectAnimation.To = new Rect(600, 50, 200, 50);&lt;/P&gt;
&lt;P&gt;// Set the animation to target the Rect property&lt;/P&gt;
&lt;P&gt;// of the object named "MyAnimatedRectangleGeometry."&lt;/P&gt;
&lt;P&gt;Storyboard.SetTargetName(myRectAnimation, "MyAnimatedRectangleGeometry");&lt;/P&gt;
&lt;P&gt;Storyboard.SetTargetProperty(&lt;/P&gt;
&lt;P&gt;myRectAnimation, new PropertyPath(RectangleGeometry.RectProperty));&lt;/P&gt;
&lt;P&gt;// Create a storyboard to apply the animation.&lt;/P&gt;
&lt;P&gt;Storyboard ellipseStoryboard = new Storyboard();&lt;/P&gt;
&lt;P&gt;ellipseStoryboard.Children.Add(myRectAnimation);&lt;/P&gt;
&lt;P&gt;// Start the storyboard when the Path loads.&lt;/P&gt;
&lt;P&gt;myPath.Loaded += delegate(object sender, RoutedEventArgs e)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;ellipseStoryboard.Begin(this);&lt;/P&gt;
&lt;P&gt;};&lt;/P&gt;
&lt;P&gt;Canvas containerCanvas = new Canvas();&lt;/P&gt;
&lt;P&gt;containerCanvas.Children.Add(myPath);&lt;/P&gt;
&lt;P&gt;Content = containerCanvas;&lt;/P&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376588</link><pubDate>Sun, 06 Jan 2008 18:36:24 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376588</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376588/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>hey evildictaitor he was n't asked your vista&amp;nbsp;OS source&amp;nbsp;which was developed by you:Phe just asked your help if know answer please try to help other then :$===========================ple try following code ::ven::[H]============================
NameScope.SetNameScope(this, new&amp;#8230;</evnet:previewtext><dc:creator>ddl</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376588/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>&lt;p&gt;I'm ignoring the request for C# instead of XAML since it's relatively easy to translate between the two. Also, my XAML targets Silverlight, but it's easy enough to change to WPF by changing the Canvas' xmlns attribute.&lt;/p&gt;
&lt;pre&gt;&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;Canvas xmlns="http://schemas.microsoft.com/client/2007"&amp;gt;
  &amp;lt;Rectangle Fill="Orange" Name="rectangle1" Width="50" Height="50"&amp;gt;
    &amp;lt;Rectangle.Triggers&amp;gt;
      &amp;lt;EventTrigger RoutedEvent="Rectangle.Loaded"&amp;gt;
        &amp;lt;EventTrigger.Actions&amp;gt;
          &amp;lt;BeginStoryboard&amp;gt;
            &amp;lt;Storyboard Storyboard.TargetProperty="(Canvas.Left)" Storyboard.TargetName="rectangle1"&amp;gt;
              &amp;lt;DoubleAnimation By="250" Duration="0:0:1"/&amp;gt;
            &amp;lt;/Storyboard&amp;gt;
          &amp;lt;/BeginStoryboard&amp;gt;
        &amp;lt;/EventTrigger.Actions&amp;gt;
      &amp;lt;/EventTrigger&amp;gt;
    &amp;lt;/Rectangle.Triggers&amp;gt;
  &amp;lt;/Rectangle&amp;gt;
&amp;lt;/Canvas&amp;gt;
&lt;/pre&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376540</link><pubDate>Sun, 06 Jan 2008 09:03:35 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376540</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376540/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>I'm ignoring the request for C# instead of XAML since it's relatively easy to translate between the two. Also, my XAML targets Silverlight, but it's easy enough to change to WPF by changing the Canvas' xmlns attribute.
&amp;lt;?xml version="1.0"?&amp;gt;
&amp;lt;Canvas&amp;#8230;</evnet:previewtext><dc:creator>JChung2006</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376540/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>I think nightski probably nailed it, but google suggests these examples of absolute positioning: &lt;a href="http://blog.kirupa.com/?p=64"&gt;1&lt;/a&gt;&amp;nbsp;and &lt;a href="http://learnwpf.com/Posts/Post.aspx?postId=c76411d6-5350-4a10-b6bb-f1481c167ecf"&gt;2&lt;/a&gt;.</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376527</link><pubDate>Sun, 06 Jan 2008 05:10:07 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376527</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376527/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>I think nightski probably nailed it, but google suggests these examples of absolute positioning: 1&amp;nbsp;and 2.</evnet:previewtext><dc:creator>Bent Rasmussen</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376527/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;vennag wrote:&lt;/div&gt;&lt;div&gt;﻿please give me the sample code&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br&gt;&lt;br&gt;This is a friendly help forum, not a free code bonanza. People here will help you learn to write your own code. They won't write it for you.&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376514</link><pubDate>Sun, 06 Jan 2008 02:08:20 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376514</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376514/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>vennag wrote:﻿please give me the sample codeThis is a friendly help forum, not a free code bonanza. People here will help you learn to write your own code. They won't write it for you.</evnet:previewtext><dc:creator>evildictaitor</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376514/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>Elements in WPF don't have a position property, or an "x" value directly.&amp;nbsp; Instead, if the element is child of a Canvas - several attached properties are utilized.&amp;nbsp; These are Canvas.Left, Canvas.Right, Canvas.Top, and Canvas.Bottom.&amp;nbsp; Using the animation code above, animate either the Canvas.Left or Canvas.Right attached property on the rectangle to move it.</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376508</link><pubDate>Sun, 06 Jan 2008 00:40:55 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376508</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376508/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Elements in WPF don't have a position property, or an "x" value directly.&amp;nbsp; Instead, if the element is child of a Canvas - several attached properties are utilized.&amp;nbsp; These are Canvas.Left, Canvas.Right, Canvas.Top, and Canvas.Bottom.&amp;nbsp; Using the animation code above, animate either the&amp;#8230;</evnet:previewtext><dc:creator>nightski</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376508/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>&lt;BLOCKQUOTE&gt;&lt;div&gt;CompGuy101 wrote:&lt;/div&gt;&lt;div&gt;﻿&lt;blockquote&gt;&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;img src="http://channel9.msdn.com/Themes/AlmostGlass/images/icon-quote.gif&gt;&lt;/td&gt;&lt;td&gt;&lt;strong&gt;vennag wrote:&lt;/strong&gt;&lt;i&gt;﻿&lt;p&gt;how to change x position of Rectangle using this code ,&lt;br&gt;please give me the sample code&lt;br&gt;&lt;br&gt;thanks&lt;/p&gt;&lt;/i&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br&gt;erik_ just gave you all the code you need.&lt;br&gt;&lt;br&gt;&lt;img src="http://channel9.msdn.com/emoticons/emotion-8.gifborder="&gt;&lt;br&gt;&lt;/div&gt;&lt;/BLOCKQUOTE&gt;&lt;br&gt;&lt;br&gt;*sigh*&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376507</link><pubDate>Sun, 06 Jan 2008 00:24:30 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376507</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376507/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>CompGuy101 wrote:﻿vennag wrote:﻿how to change x position of Rectangle using this code ,please give me the sample codethankserik_ just gave you all the code you need.*sigh*</evnet:previewtext><dc:creator>Lloyd Humphreys</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376507/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>&lt;P&gt;how to change x position of Rectangle using this code ,&lt;BR&gt;please give me the sample code&lt;BR&gt;&lt;BR&gt;thanks&lt;/P&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376491</link><pubDate>Sat, 05 Jan 2008 21:36:03 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376491</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376491/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>how to change x position of Rectangle using this code ,please give me the sample codethanks</evnet:previewtext><dc:creator>vennag</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376491/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>I reckon this would be better placed in the Techoff :)&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376418</link><pubDate>Sat, 05 Jan 2008 11:27:30 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376418</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376418/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>I reckon this would be better placed in the Techoff :)</evnet:previewtext><dc:creator>Lloyd Humphreys</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376418/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>Sample from msdn:&lt;BR&gt;&lt;BR&gt;&lt;PRE&gt;using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Media.Animation;

namespace SDKSample
{

    public class RectangleOpacityFadeExample : Page
    {
        private Storyboard myStoryboard;

        public RectangleOpacityFadeExample()
        {
            NameScope.SetNameScope(this, new NameScope());

            this.WindowTitle = "Fading Rectangle Example";
            StackPanel myPanel = new StackPanel();
            myPanel.Margin = new Thickness(10);

            Rectangle myRectangle = new Rectangle();
            myRectangle.Name = "myRectangle";
            this.RegisterName(myRectangle.Name, myRectangle);
            myRectangle.Width = 100;
            myRectangle.Height = 100;
            myRectangle.Fill = Brushes.Blue;

            DoubleAnimation myDoubleAnimation = new DoubleAnimation();
            myDoubleAnimation.From = 1.0;
            myDoubleAnimation.To = 0.0;
            myDoubleAnimation.Duration = new Duration(TimeSpan.FromSeconds(5));
            myDoubleAnimation.AutoReverse = true;
            myDoubleAnimation.RepeatBehavior = RepeatBehavior.Forever;

            myStoryboard = new Storyboard();
            myStoryboard.Children.Add(myDoubleAnimation);
            Storyboard.SetTargetName(myDoubleAnimation, myRectangle.Name);
            Storyboard.SetTargetProperty(myDoubleAnimation, new PropertyPath(Rectangle.OpacityProperty));

            // Use the Loaded event to start the Storyboard.
            myRectangle.Loaded += new RoutedEventHandler(myRectangleLoaded);  

            myPanel.Children.Add(myRectangle);
            this.Content = myPanel;
        }

        public void myRectangleLoaded(object sender, RoutedEventArgs e)
        {
            myStoryboard.Begin(this);
        }

    }
}
&lt;/PRE&gt;&lt;BR&gt;&lt;BR&gt;See &lt;a href="http://msdn2.microsoft.com/en-us/library/ms752312(VS.85).aspx"&gt;http://msdn2.microsoft.com/en-us/library/ms752312(VS.85).aspx&lt;/a&gt;&amp;nbsp;for more.&lt;BR&gt;&lt;BR&gt;Modify it to target the position instead of Rectangle.OpacityProperty..&lt;BR&gt;&lt;BR&gt;Let me know if you need a cut &amp;amp; paste sample +)</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376414</link><pubDate>Sat, 05 Jan 2008 10:07:59 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376414</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376414/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>Sample from msdn:using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Shapes;
using System.Windows.Media;
using System.Windows.Media.Animation;

namespace SDKSample
{

    public class RectangleOpacityFadeExample : Page
    {
        private Storyboard&amp;#8230;</evnet:previewtext><dc:creator>erik_</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376414/Trackback.aspx</trackback:ping></item><item><title>Re: how to move Rectangle from left to right with wpf(c# code not with xaml)</title><description>When it is at the left, it's x position is 0. When it is at right, it's x position is (Container.Width - item.Width).&lt;br&gt;&lt;br&gt;Just animation the two together. There's more than enough stuff like this on the internet.&lt;br&gt;</description><comments></comments><link>http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376407</link><pubDate>Sat, 05 Jan 2008 04:41:34 GMT</pubDate><guid isPermaLink="false">http://channel9.msdn.com/forums/Coffeehouse/260049-how-to-move-Rectangle-from-left-to-right-with-wpfc-code-not-with-xaml/?CommentID=376407</guid><evnet:views>0</evnet:views><evnet:viewtrackingurl>http://channel9.msdn.com/376407/WebViewBug.aspx?EVT=0</evnet:viewtrackingurl><evnet:previewtext>When it is at the left, it's x position is 0. When it is at right, it's x position is (Container.Width - item.Width).Just animation the two together. There's more than enough stuff like this on the internet.</evnet:previewtext><dc:creator>evildictaitor</dc:creator><slash:comments>0</slash:comments><wfw:commentRss></wfw:commentRss><trackback:ping>http://channel9.msdn.com/376407/Trackback.aspx</trackback:ping></item></channel></rss>