<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Verbosity: A Silverlight Story</title>
	<atom:link href="http://paulmignard.com/2010/01/verbosity-a-silverlight-story/feed/" rel="self" type="application/rss+xml" />
	<link>http://paulmignard.com/2010/01/verbosity-a-silverlight-story/</link>
	<description></description>
	<lastBuildDate>Mon, 25 Jul 2011 23:08:38 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Scott</title>
		<link>http://paulmignard.com/2010/01/verbosity-a-silverlight-story/comment-page-1/#comment-1956</link>
		<dc:creator>Scott</dc:creator>
		<pubDate>Fri, 08 Jan 2010 20:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://paulmignard.com/?p=342#comment-1956</guid>
		<description>Hi Paul,

As other posters have mentioned it tends to be easiest to set up the declaritive appearance of the object in XAML and then perform the more advanced operations in code. It is a pretty productive combination and just giving your XAML objects an x:Name makes coding against them easy.  

However if you want to stick to all code, below is the closest translation of your Flash app into Silverlight.  When you start performing more advanced animations you will probably want to use the Storyboard class since it has a lot of great advanced funtionality, but for something simple like the example above the Rendering event is a good equivalent of the ENTER_FRAME event as Alexandr pointed out . 

using System;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Shapes;
using System.Windows.Media.Effects;

namespace CircleExample
{
    public partial class MainPage : UserControl
    {
        Ellipse circle = new Ellipse();

        public MainPage()
        {
            InitializeComponent();

            circle.Stroke = new SolidColorBrush(Colors.Black);
            circle.Fill = new SolidColorBrush(Color.FromArgb(255, 29, 93, 143));
            circle.Width = 100;
            circle.Height = 100;

            LayoutRoot.Children.Add(circle);
            circle.SetValue(Canvas.LeftProperty, 100.0);
            circle.SetValue(Canvas.TopProperty, 100.0);
            
            circle.Effect = new DropShadowEffect();

            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }

        void CompositionTarget_Rendering(object sender, EventArgs e)
        {
            Canvas.SetLeft(circle, Canvas.GetLeft(circle) + 1);
        }
    }
}</description>
		<content:encoded><![CDATA[<p>Hi Paul,</p>
<p>As other posters have mentioned it tends to be easiest to set up the declaritive appearance of the object in XAML and then perform the more advanced operations in code. It is a pretty productive combination and just giving your XAML objects an x:Name makes coding against them easy.  </p>
<p>However if you want to stick to all code, below is the closest translation of your Flash app into Silverlight.  When you start performing more advanced animations you will probably want to use the Storyboard class since it has a lot of great advanced funtionality, but for something simple like the example above the Rendering event is a good equivalent of the ENTER_FRAME event as Alexandr pointed out . </p>
<p>using System;<br />
using System.Windows.Controls;<br />
using System.Windows.Media;<br />
using System.Windows.Shapes;<br />
using System.Windows.Media.Effects;</p>
<p>namespace CircleExample<br />
{<br />
    public partial class MainPage : UserControl<br />
    {<br />
        Ellipse circle = new Ellipse();</p>
<p>        public MainPage()<br />
        {<br />
            InitializeComponent();</p>
<p>            circle.Stroke = new SolidColorBrush(Colors.Black);<br />
            circle.Fill = new SolidColorBrush(Color.FromArgb(255, 29, 93, 143));<br />
            circle.Width = 100;<br />
            circle.Height = 100;</p>
<p>            LayoutRoot.Children.Add(circle);<br />
            circle.SetValue(Canvas.LeftProperty, 100.0);<br />
            circle.SetValue(Canvas.TopProperty, 100.0);</p>
<p>            circle.Effect = new DropShadowEffect();</p>
<p>            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);<br />
        }</p>
<p>        void CompositionTarget_Rendering(object sender, EventArgs e)<br />
        {<br />
            Canvas.SetLeft(circle, Canvas.GetLeft(circle) + 1);<br />
        }<br />
    }<br />
}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paul</title>
		<link>http://paulmignard.com/2010/01/verbosity-a-silverlight-story/comment-page-1/#comment-1955</link>
		<dc:creator>paul</dc:creator>
		<pubDate>Fri, 08 Jan 2010 19:42:25 +0000</pubDate>
		<guid isPermaLink="false">http://paulmignard.com/?p=342#comment-1955</guid>
		<description>@Alexandr - Wow, that was EXACTLY what i was looking for! In looking through books and googling a way to create an animation, what I posted was the best I could come up with.  Thanks for pointing me in that direction, I&#039;m totally going to try that out!

@Jeremy - I&#039;ve written a couple of large-ish apps with Flex and my experience there was that I constantly found myself re-writing MXML into actionscript because what I wanted to do with the object was too complex (or difficult) to maintain with mxml alone. Good point though, maybe I should give Silverlight a little more of a chance before I attribute difficulties to it that I hadn&#039;t come across yet...

Um, wow, so...the Silverlight community is on top of things - Thanks for the help guys!</description>
		<content:encoded><![CDATA[<p>@Alexandr &#8211; Wow, that was EXACTLY what i was looking for! In looking through books and googling a way to create an animation, what I posted was the best I could come up with.  Thanks for pointing me in that direction, I&#8217;m totally going to try that out!</p>
<p>@Jeremy &#8211; I&#8217;ve written a couple of large-ish apps with Flex and my experience there was that I constantly found myself re-writing MXML into actionscript because what I wanted to do with the object was too complex (or difficult) to maintain with mxml alone. Good point though, maybe I should give Silverlight a little more of a chance before I attribute difficulties to it that I hadn&#8217;t come across yet&#8230;</p>
<p>Um, wow, so&#8230;the Silverlight community is on top of things &#8211; Thanks for the help guys!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jeremy Likness</title>
		<link>http://paulmignard.com/2010/01/verbosity-a-silverlight-story/comment-page-1/#comment-1954</link>
		<dc:creator>Jeremy Likness</dc:creator>
		<pubDate>Fri, 08 Jan 2010 19:11:35 +0000</pubDate>
		<guid isPermaLink="false">http://paulmignard.com/?p=342#comment-1954</guid>
		<description>Why write machine level code if I can use a higher level language? In the same token, why compare the bits and bytes of code-behind for this when there are tools that make it easy and fast? Comparing lines of code or verbosity only makes as much sense as the time/effort/and maintainability of the application as the result. 

If I want to animate an ellipse and move it around, I&#039;ll use Blend. Here is your example with a more advanced animation and even triggers on a click done in two minutes: 

http://screencast.com/t/ZGNiMjBlMDk

The XAML is only a few lines and I&#039;m not sure I buy the argument that XAML makes a &quot;difficult point and stabby XML file.&quot; When you become familiar with XAML in a similar way you have your &quot;Flex Builder muscle memory&quot; then navigating XAML files is quick and easy.</description>
		<content:encoded><![CDATA[<p>Why write machine level code if I can use a higher level language? In the same token, why compare the bits and bytes of code-behind for this when there are tools that make it easy and fast? Comparing lines of code or verbosity only makes as much sense as the time/effort/and maintainability of the application as the result. </p>
<p>If I want to animate an ellipse and move it around, I&#8217;ll use Blend. Here is your example with a more advanced animation and even triggers on a click done in two minutes: </p>
<p><a href="http://screencast.com/t/ZGNiMjBlMDk" rel="nofollow">http://screencast.com/t/ZGNiMjBlMDk</a></p>
<p>The XAML is only a few lines and I&#8217;m not sure I buy the argument that XAML makes a &#8220;difficult point and stabby XML file.&#8221; When you become familiar with XAML in a similar way you have your &#8220;Flex Builder muscle memory&#8221; then navigating XAML files is quick and easy.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alexandr Porubov</title>
		<link>http://paulmignard.com/2010/01/verbosity-a-silverlight-story/comment-page-1/#comment-1953</link>
		<dc:creator>Alexandr Porubov</dc:creator>
		<pubDate>Fri, 08 Jan 2010 18:33:15 +0000</pubDate>
		<guid isPermaLink="false">http://paulmignard.com/?p=342#comment-1953</guid>
		<description>Hello. 

Code may be smaller. Actually, if the developer wants to write all on C # he will write so: 
using System;
using System.Windows.Shapes;
using System.Windows.Media.Effects;
using System.Windows.Controls;
using System.Windows.Media;
using System.Windows.Markup;

namespace SLTest {
    public partial class MainPage : UserControl {
        const string defaultNS = &quot; xmlns=&#039;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#039; &quot;;
        Ellipse circle;
        public MainPage() {
            InitializeComponent();

            string def = &quot;&quot;;
            circle = (Ellipse)XamlReader.Load(def);

            circle.Width = 100;
            circle.Height = 100;        

            circle.Effect = new DropShadowEffect();

            Canvas.SetLeft(circle, 100);
            Canvas.SetTop(circle, 100);

            LayoutRoot.Children.Add(circle);
            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
        }

        void CompositionTarget_Rendering(object sender, EventArgs e) {
            Canvas.SetLeft(circle, Canvas.GetLeft(circle) + 1);
        }
    }
}

This code do same as flash code.

&quot;CompositionTarget.Rendering&quot; - analog &quot;EnterFrame&quot; in flash.

PS: Why not to use XAML? Using it, only 1 xaml line and 2 code line is necessary.</description>
		<content:encoded><![CDATA[<p>Hello. </p>
<p>Code may be smaller. Actually, if the developer wants to write all on C # he will write so:<br />
using System;<br />
using System.Windows.Shapes;<br />
using System.Windows.Media.Effects;<br />
using System.Windows.Controls;<br />
using System.Windows.Media;<br />
using System.Windows.Markup;</p>
<p>namespace SLTest {<br />
    public partial class MainPage : UserControl {<br />
        const string defaultNS = &#8221; xmlns=&#8217;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8217; &#8220;;<br />
        Ellipse circle;<br />
        public MainPage() {<br />
            InitializeComponent();</p>
<p>            string def = &#8220;&#8221;;<br />
            circle = (Ellipse)XamlReader.Load(def);</p>
<p>            circle.Width = 100;<br />
            circle.Height = 100;        </p>
<p>            circle.Effect = new DropShadowEffect();</p>
<p>            Canvas.SetLeft(circle, 100);<br />
            Canvas.SetTop(circle, 100);</p>
<p>            LayoutRoot.Children.Add(circle);<br />
            CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);<br />
        }</p>
<p>        void CompositionTarget_Rendering(object sender, EventArgs e) {<br />
            Canvas.SetLeft(circle, Canvas.GetLeft(circle) + 1);<br />
        }<br />
    }<br />
}</p>
<p>This code do same as flash code.</p>
<p>&#8220;CompositionTarget.Rendering&#8221; &#8211; analog &#8220;EnterFrame&#8221; in flash.</p>
<p>PS: Why not to use XAML? Using it, only 1 xaml line and 2 code line is necessary.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

