<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Corey Schuman &#187; Silverlight</title>
	<atom:link href="http://www.85turns.com/tag/silverlight/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.85turns.com</link>
	<description>Silverlight Consultant</description>
	<lastBuildDate>Tue, 26 Apr 2011 20:57:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Silverlight MVP</title>
		<link>http://www.85turns.com/2009/10/07/silverlight-mvp/</link>
		<comments>http://www.85turns.com/2009/10/07/silverlight-mvp/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 21:07:24 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Genral]]></category>
		<category><![CDATA[MVP]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/10/07/silverlight-mvp/</guid>
		<description><![CDATA[On October 1st I was awarded the Microsoft MVP for Silverlight.&#160; I am very honored and excited about this.&#160; The MVP program, taken from Tim Heuer’s post, “ is a recognition program that is in place to recognize and reward those individuals who have been identified by individuals (peers, Microsoft staff, etc.) as experts in [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.85turns.com/blog/wp-content/uploads/images/MVP_12FB8/image.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/images/MVP_12FB8/image_thumb.png" width="270" height="109" /></a></p>
<p>On October 1st I was awarded the Microsoft MVP for Silverlight.&#160; I am very honored and excited about this.&#160; The MVP program, taken from <a href="http://timheuer.com/blog/archive/2009/10/01/new-silverlight-mvp-announcement-october-2009.aspx" target="_blank">Tim Heuer’s post</a>, <font color="#808080">“ is a recognition program that is in place to recognize and reward those individuals who have been identified by individuals (peers, Microsoft staff, etc.) as experts in their technology field and global contributors to the technology”</font></p>
<p>The other talented group of guys in this round of Silverlight MVP’s are (for the complete list of Silverlight MVP’s follow <a href="https://mvp.support.microsoft.com/communities/mvp.aspx?product=1&amp;competency=Silverlight" target="_blank">this link</a>):</p>
<ul>
<li><a href="http://www.designwithsilverlight.com/">Jeff Paries</a></li>
<li>Ambrose Little </li>
<li><a href="http://nerdplusart.com">Robby Ingebretsen</a></li>
<li><a href="http://www.cynergysystems.com/blogs/blogs/rick.barraza/">Rick Barraza</a> </li>
<li><a href="http://blogs.sqlxml.org/BryantLikes">Bryant Likes</a>&#160; </li>
<li><a href="http://www.davidezordan.net/blog/">Davide Zordan</a></li>
<li><a href="http://www.cnblogs.com/terrylee">Huijun Li</a></li>
</ul>
<p>Talking about and working with Silverlight has been a dream come true.&#160; It enables me to pursue my passion of creating experiences and not applications (more to come on that).&#160; </p>
<p>There have been many people who have helped me in the MVP process; namely Glen Gordon, Jesse Liberty, Tim Heuer, John Papa, and Justin Angel.&#160; Thank you, and I look forward to the upcoming year.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/10/07/silverlight-mvp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Testing Silverlight from Windows Live Writer</title>
		<link>http://www.85turns.com/2009/07/14/testing-silverlight-in-windows-live-writer/</link>
		<comments>http://www.85turns.com/2009/07/14/testing-silverlight-in-windows-live-writer/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 02:39:53 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[grinds my gears]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[windows live writer]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/07/14/testing-silverlight-in-windows-live-writer/</guid>
		<description><![CDATA[Today SmartyP (did you get that Roger, I didn’t use your name) was letting me know what Grinds his Gears which is: Why do Silverlight bloggers not embed Silverlight applications into their posts.  Admittedly, I don’t have a single post that has an embedded Silverlight app. The root of the my problem is the lack [...]]]></description>
			<content:encoded><![CDATA[<p>Today <a href="http://smartypantscoding.com" target="_blank">SmartyP</a> (did you get that Roger, I didn’t use your name) was letting me know what <a href="http://www.youtube.com/watch?v=aVj7TRAu9iU" target="_blank">Grinds his Gears</a> which is: <em>Why do Silverlight bloggers not embed Silverlight applications into their posts</em>.  Admittedly, I don’t have a single post that has an embedded Silverlight app.</p>
<p>The root of the my problem is the lack of support for embedding Silverlight into <a href="http://windowslivewriter.spaces.live.com/" target="_blank">Windows Live Writer</a> (WLW).  It’s possible, with WordPress, to embed Silverlight through the web interface, but WLW’s features outweigh what the web dashboard can do (namely pasting in screen shots without having to save them to the file system and then upload).</p>
<p>After a little digging tonight, I came across <a href="http://blogs.infosupport.com/blogs/ernow/archive/2009/06/21/silverlight-windows-live-writer-and-wordpress.aspx" target="_blank">this</a> post by <a href="http://blogs.infosupport.com/members/ernow/default.aspx">Erno de Weerd</a>.  It details how to embed Silverlight apps into Windows Live Writer.  FWIW, this method uses <a href="http://timheuer.com/" target="_blank">Tim Heuer’s</a> <a href="http://wordpress.org/extend/plugins/silverlight-for-wordpress/" target="_blank">Silverlight WordPress Plugin</a>.</p>
<p>Without further ado…drum roll…here’s the test:</p>
<div id="scid:CFEDF738-22D6-410b-9F8B-86DC19B18415:08f87580-23a8-4ce3-b2ad-eb361c8dc193" class="wlWriterEditableSmartContent" style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px"><div id="silverlightControlHost"><object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="400" height="250"><param name="source" value="/blog/wp-content/uploads/2009/07/helloworldfromlivewriter.xap"/><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40624.0" /><param name="autoupgrade" value="true" /><param name="enableHtmlAccess" value="true" /><a href="http://go.microsoft.com/fwlink/?LinkID=149156" style="text-decoration: none;"><img src="http://storage.timheuer.com/sl4wp-ph.png" alt="Install Microsoft Silverlight" style="border-style: none; width:400px; height:200px"/></a></object><iframe style="visibility:hidden;height:0;width:0;border:0px" id="_sl_historyFrame"></iframe></div><br /></div>
<p>Finally, completely unSilverlight related, I always reference <a href="http://www.youtube.com/watch?v=aVj7TRAu9iU" target="_blank">Grinds his Gears</a>. It’s such a great line, you can complain without complaining.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/07/14/testing-silverlight-in-windows-live-writer/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Editing a ToolTip Style in Blend 3</title>
		<link>http://www.85turns.com/2009/07/10/editing-a-tooltip-style-in-blend-3/</link>
		<comments>http://www.85turns.com/2009/07/10/editing-a-tooltip-style-in-blend-3/#comments</comments>
		<pubDate>Fri, 10 Jul 2009 20:41:11 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[tooltip]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/07/10/editing-a-tooltip-style-in-blend-3/</guid>
		<description><![CDATA[ToolTips are a great way to display mouse over information, while increasing your applications accessibility.&#160; UI designers are increasingly demanding the use of rich overlays in applications.&#160; Meaning, instead of a standard Tooltip, a designer might want to add polish by adding animation or having a rich UI to a overlay.&#160; Initially you may consider [...]]]></description>
			<content:encoded><![CDATA[<p>ToolTips are a great way to display mouse over information, while increasing your applications accessibility.&#160; UI designers are increasingly demanding the use of rich overlays in applications.&#160; Meaning, instead of a standard Tooltip, a designer might want to add polish by adding animation or having a rich UI to a overlay.&#160; Initially you may consider wiring up a <strong>MouseEnter</strong> and <strong>MouseLeave</strong> event, then handle an overlay through the code; however, I would encourage you to take a look (or second look) at the Tooltip.</p>
<p>Out of the box, styling a Tooltip in Blend is a manual process.&#160; The below screenshots/descriptions show how to do this.</p>
<ol>
<li>First, add a Tooltip; do this in the Xaml view to look like the below Xaml.<a href="http://www.85turns.com/blog/wp-content/uploads/2009/07/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/07/image-thumb.png" width="587" height="118" /></a>       </li>
<li>Next, click, in Xaml, on the <strong>&lt;ToolTip </strong>tag.&#160; This will change the breadcrumb at the top of the Artboard to show <strong>[ToolTip]</strong>.&#160; Click on the breadcrumb and select <strong>Edit Template </strong>&gt; <strong>Edit a Copy</strong>.
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/07/image1.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/07/image-thumb1.png" width="480" height="469" /></a>       </li>
<li>After creating the Template, there is a chance your Artboard will look like the below image.&#160; You’ll notice that you’re in the context of editing the ToolTip template without visuals.&#160; If you experience this, go to step 4 to see how you can edit the visuals.
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/07/image2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/07/image-thumb2.png" width="600" height="455" /></a>       </li>
<li>To edit the ToolTip, click the Resources tab, locate the ToolTip style, right click and select Edit.&#160; The Artboard will show the visuals for the ToolTip.&#160; You can now edit the ToolTip like any other control.
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/07/image3.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/07/image-thumb3.png" width="537" height="298" /></a> </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/07/10/editing-a-tooltip-style-in-blend-3/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>ToggleButton Command for Prism</title>
		<link>http://www.85turns.com/2009/06/24/togglebutton-command-for-prism/</link>
		<comments>http://www.85turns.com/2009/06/24/togglebutton-command-for-prism/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 23:29:33 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[commands]]></category>
		<category><![CDATA[composite framework]]></category>
		<category><![CDATA[prism]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[togglebutton]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/06/24/togglebutton-command-for-prism/</guid>
		<description><![CDATA[&#160;Prism Commands enables you to handle user interactions in Xaml.&#160; Even though the plumbing is there, Prism lacks commanding support for everything but Buttons.&#160; Fortunately, it’s relatively easy to create new Commands for a range of controls.&#160; This post details how to create a Checked and UnChecked Command for the ToggleButton (which can be applied [...]]]></description>
			<content:encoded><![CDATA[<p>&#160;<a href="http://msdn.microsoft.com/en-us/library/dd458928.aspx" target="_blank">Prism Commands</a> enables you to handle user interactions in Xaml.&#160; Even though the plumbing is there, Prism lacks commanding support for everything but Buttons.&#160; Fortunately, it’s relatively easy to create new Commands for a range of controls.&#160; This post details how to create a <strong>Checked</strong> and <strong>UnChecked</strong> Command for the <strong>ToggleButton</strong> (which can be applied to a <strong>RadioButton</strong> and a <strong>CheckBox</strong>).</p>
<p>Recently I had a need to create a <strong>Checked</strong> Command for a <strong>ToggleButton</strong>.&#160; There are many sources on how to create a Command, the best one probably being <a href="http://development-guides.silverbaylabs.org/Video/Prism-Commands" target="_blank">Erik Mork’s video</a>, but there wasn’t a place to <em>grab</em> the a Command from.&#160; The intention of this post is to share the <strong>Checked</strong> and <strong>UnChecked</strong> Prism Commands for you to use it in your project.&#160; (Moving forward, it might make sense to create a repository of these Commands.)</p>
<p>Finally, before diving in, if you just want the code and to see an example, follow these links:</p>
<ul>
<li><font size="5"><a href="http://85turns.com/silverlight/zips/CustomCommands.zip" target="_blank">Code</a></font></li>
<li><font size="5"><a href="http://85turns.com/silverlight/CustomCommands.html" target="_blank">Example</a></font></li>
</ul>
<h3>Commands</h3>
<p>Creating the Commands is straight forward.&#160; Derive from <strong>CommandBehaviorBase</strong> and specify the type.&#160; Then, in the constructor, register the event.&#160; Below are both the <strong>Checked</strong> and <strong>UnChecked</strong> commands. </p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb3.png" width="600" height="510" /></p>
<h3>Extensions for Xaml</h3>
<p>After creating the Commands you need to create Static methods to reference in Xaml.&#160; The Static methods are named <strong>Checked</strong> and <strong>UnChecked</strong>.&#160; They include a definition for:</p>
<ul>
<li>SelectedCommandBehaviorProperty</li>
<li>CommandProperty</li>
<li>SetCommand</li>
<li>GetCommand</li>
<li>OnSetCommandCallback</li>
<li>GetOrCreateBehavior</li>
</ul>
<p>In an effort to be brief I have chosen to truncate the two static methods.&#160; To take a closer look at the code, click on the image or download the code. </p>
<p>Checked.cs   <br /><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image3.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb4.png" width="240" height="143" /></a></p>
<p align="center">UnChecked.cs   <br />&#160;<a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image4.png"><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb5.png" width="240" height="143" /></a> </p>
<h3>Hooking everything up</h3>
<p>After the Commands are created, bind them to the <strong>ToggleButton</strong> in Xaml.&#160; In this sample application there are three main files:</p>
<ul>
<li><strong>MainPage.xaml</strong> – the presentation. This contains the binding to the Commands.</li>
<li><strong>MainPage.xaml.cs</strong> – the primary function of the code-behind is to new up the <strong>MainPageModel</strong> and set the <strong>DataContext</strong>.</li>
<li><strong>MainPageModel.cs</strong> – this is the model for the <strong>MainPage</strong>. It defines the commands the Xaml binds to as well as a property for the <strong>TextBox</strong> to bind to.</li>
</ul>
<p>Below are images of the classes mentioned above:</p>
<h4>MainPage.xaml</h4>
<p>Note in this Xaml, line 20 binds to the <strong>CheckedState</strong> property in the <strong>MainPageModel</strong>.&#160; The commands are bound on line 22 and 23.&#160; Take notice of the namespace command.&#160; Instead of referencing <strong>Microsoft.Practices.Composite.Presentation.Commands</strong> it references<strong> ProjectName.CustomCommands</strong>.</p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image5.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb6.png" width="600" height="477" /></a> </p>
<h4>MainPage.xaml.cs</h4>
<p>This is the code-behind for the above <strong>UserControl</strong>.&#160; On the <strong>Loaded</strong>, a new instance of <strong>MainPageModel</strong> is initialized and then set as the <strong>DataContext</strong> to the <strong>UserControl</strong>.&#160; The heavy lifting is done in the <strong>MainPageModel</strong>.</p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image6.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb7.png" width="592" height="601" /></a> </p>
<h4>MainPageModel.cs</h4>
<p>As noted above, the <strong>MainPageModel</strong> does the heavy lifting.&#160; The following describe what happens in this file:</p>
<ul>
<li>Two <strong>DelegateCommands</strong> are defined for <strong>Checked</strong> and <strong>UnChecked</strong>. (line 36 and 41)</li>
<li>A Property called <strong>CheckedState</strong> is defined and fires the <strong>PropertyChanged</strong> event when updated. (lines 13 – 22)</li>
<li>Two methods are defined to handle the actions on the Commands. (lines 47 – 59)</li>
</ul>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image7.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb8.png" width="600" height="1043" /></a> </p>
<h3>The final product</h3>
<p><font size="5"><a href="http://85turns.com/silverlight/zips/CustomCommands.zip" target="_blank">Code</a> | </font><font size="5"><a href="http://85turns.com/silverlight/CustomCommands.html" target="_blank">Example</a></font></p>
<p><a href="http://85turns.com/silverlight/CustomCommands.html"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image8.png" width="570" height="423" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/06/24/togglebutton-command-for-prism/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Versioning your Silverlight application</title>
		<link>http://www.85turns.com/2009/06/11/versioning-your-silverlight-application/</link>
		<comments>http://www.85turns.com/2009/06/11/versioning-your-silverlight-application/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 03:34:27 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[assembly]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[version]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/06/11/versioning-your-silverlight-application/</guid>
		<description><![CDATA[When writing an enterprise level application it’s critical to have a version number.&#160; Whether it’s located on the help screen or in debug mode, this will save you so much heartache during QA.&#160; The larger the project, the more dependent your team is on the version. Now that I’m all done ranting to the converted, [...]]]></description>
			<content:encoded><![CDATA[<p>When writing an enterprise level application it’s critical to have a version number.&#160; Whether it’s located on the help screen or in debug mode, this will save you so much heartache during QA.&#160; The larger the project, the more dependent your team is on the version.</p>
<p>Now that I’m all done ranting to the converted, let’s talk about Silverlight.&#160; From my past experience there are two ways to handle versioning:</p>
<ol>
<li>Create an abstracted file that contains your version number, or </li>
<li>Use the Assembly version.</li>
</ol>
<p>Both have their pros and cons.&#160; Option 1 gives you greater control of the version number, however the manual process is tedious.&#160; Option 2 enables you to use the Assemblies version, however it provides less control over the version number.&#160; Lately I’ve been going with option 2 because it takes one more step out of my deployment process.</p>
<h3>To get the version from the Assembly</h3>
<p>Doing this is fairly easy once you have the correct block of code.&#160; The below block of code shows how to get the version from the Assembly in the <strong>MainPage_Loaded</strong> method.&#160; Do not forget to include the <strong>System.Reflection</strong> reference.</p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb.png" width="600" height="455" /></a> </p>
<p>Given the above block of code, the next question is, where is this assembly version defined?&#160; In short, the AssemblyInfo.cs file, which is located in the Properties folder.</p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image1.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb1.png" width="200" height="204" /></a> </p>
<p>At the bottom of the AssemblyInfo.cs file, you’ll see the version info.&#160; The directions are in the comments on how to change this.&#160; I’ve customized my version to be 0.611.*. </p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/06/image2.png"><img style="border-bottom: 0px; border-left: 0px; display: block; float: none; margin-left: auto; border-top: 0px; margin-right: auto; border-right: 0px" title="image" border="0" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/06/image-thumb2.png" width="600" height="185" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/06/11/versioning-your-silverlight-application/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>New Preloader for Silverlight</title>
		<link>http://www.85turns.com/2009/02/23/new-preloader-for-silverlight/</link>
		<comments>http://www.85turns.com/2009/02/23/new-preloader-for-silverlight/#comments</comments>
		<pubDate>Mon, 23 Feb 2009 18:29:43 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Animations]]></category>
		<category><![CDATA[preloader]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/02/23/new-preloader-for-silverlight/</guid>
		<description><![CDATA[Tim Heuer announced on his blog three ways to get a free pass for MIX09: Design a LineRider map, Visualize data in Silverlight, or Create a new preloader for Silverlight. For some time I’ve been wanting a new default preloader for Silverlight.  The loader is the first impression users have of both Silverlight and your [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://timheuer.com">Tim Heuer</a> announced on his blog three ways to get a free pass for <a href="http://2009.visitmix.com/">MIX09</a>:</p>
<ol>
<li>Design a <a href="http://linerider.com">LineRider</a> map,</li>
<li>Visualize data in Silverlight,</li>
<li>or Create a new preloader for Silverlight.</li>
</ol>
<p>For some time I’ve been wanting a new default preloader for Silverlight.  The loader is the first impression users have of both Silverlight and your application.  Currently the preloader doesn’t have any branding and contains a simple animation and type.  You’ve seen it a thousand times, but in case you haven’t, this is what is the current loader looks like:</p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/02/image3.png"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image-thumb2.png" border="0" alt="image" width="127" height="117" /></a></p>
<p>So, Tim’s contest was the motivation I needed to put my pen to paper (or pixels to screen) and create a new preloader.  Here are a couple ideas:</p>
<ul>
<li><strong>Type</strong> – This preloader is solely inspired by a strong use of type.  It is clean, simple, and to the point.  The type being used is <a href="http://en.wikipedia.org/wiki/Georgia_(typeface)" target="_blank">Georgia</a>, a web safe typeface,<br />
<a href="http://85turns.com/silverlight/Preloader.html" target="_blank"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image4.png" border="0" alt="image" width="130" height="121" /></a> </li>
<li><strong>Branded bar</strong> – This preloader focuses on branding.  The bar is very simple, almost too simple.  Out of all three this is my least favorite, however it was the first one created.  Got the juices flowing.<br />
<a href="http://85turns.com/silverlight/Preloader.html" target="_blank"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image5.png" border="0" alt="image" width="285" height="93" /></a></li>
<li><strong>Strong bar </strong>– The idea behind this loader is the background color of the loader changes based on the background color of your application.<br />
<strong>[THIS IS A WORK IN PROGRESS</strong>.  I want to get something up before the contest is over.]<br />
<a href="http://85turns.com/silverlight/Preloader.html" target="_blank"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image6.png" border="0" alt="image" width="358" height="136" /></a></li>
</ul>
<h3>Links</h3>
<p>The application with the three preloaders – <a title="http://85turns.com/silverlight/Preloader.html" href="http://85turns.com/silverlight/Preloader.html">http://85turns.com/silverlight/Preloader.html</a></p>
<p>Tim Heuer’s contest page – <a title="http://timheuer.com/blog/archive/2009/02/17/write-silverlight-code-and-win-a-pass-to-mix.aspx" href="http://timheuer.com/blog/archive/2009/02/17/write-silverlight-code-and-win-a-pass-to-mix.aspx">http://timheuer.com/blog/archive/2009/02/17/write-silverlight-code-and-win-a-pass-to-mix.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/02/23/new-preloader-for-silverlight/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
		<item>
		<title>XAML guidelines and best practices</title>
		<link>http://www.85turns.com/2009/02/09/xaml-guidelines-and-best-practices/</link>
		<comments>http://www.85turns.com/2009/02/09/xaml-guidelines-and-best-practices/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 05:33:57 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[UI]]></category>
		<category><![CDATA[best practices]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[wpf]]></category>
		<category><![CDATA[XAML]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/02/09/xaml-guidelines-and-best-practices/</guid>
		<description><![CDATA[Everyone has their own opinion on how source code should be structured and formatted.&#160; What really matters when it comes to code is not saving the CPU a couple cycles, rather enabling others to read and understand what you’ve written.&#160; This comes from Martin Fowler’s classic book Refactoring: There is another user of your source [...]]]></description>
			<content:encoded><![CDATA[<p>Everyone has their own opinion on how source code should be structured and formatted.&#160; What really matters when it comes to code is not saving the CPU a couple cycles, rather enabling others to read and understand what you’ve written.&#160; This comes from Martin Fowler’s classic book <a href="http://books.google.com/books?id=1MsETFPD3I0C&amp;printsec=frontcover">Refactoring</a>:</p>
<blockquote><p><font style="background-color: #ffffff">There is another user of your source code.&#160; Someone will try to read your code in a few month&#8217;s’ time to make some changes.&#160; We easily forget that extra user of the code, yet that user is actually the most important.&#160; Who cares if the computer takes a few more cycles to compile something?&#160; It does matter if it takes a programmer a week to make a change that would have taken only an hour if she had understood your code.</font></p>
</blockquote>
<p>When it comes to XAML, there aren’t too many opinions/articles talking about best practices (compared to other languages/markup).&#160; In fact, the definitive guide for XAML guidelines is Jaime Rodriguez’s (<a href="http://blogs.msdn.com/jaimer/default.aspx">site</a>) best practice web cast series and the resulting whitepaper (<a href="http://www.cookingwithxaml.com/content/xamlguidelines/xamlGuidelinesDraft0.pdf">pdf</a>).</p>
<blockquote><p><a href="http://blogs.msdn.com/jaimer/archive/2008/12/16/xaml-practices-series-part1.aspx">XAML practices series, part1</a></p>
<p><a href="http://channel9.msdn.com/shows/Continuum/XAML-Guidelines-Part-2/">XAML practices series, part2</a></p>
<p><a href="http://blogs.msdn.com/jaimer/archive/2009/01/13/xaml-guidelines-part-3-draft.aspx">XAML practices series, part3</a></p>
</blockquote>
<p>Jaime’s whitepaper is a must read for anyone in the Silverlight space.&#160; </p>
<p>Since my blog is less formal than a whitepaper, I’m able to give a stronger opinion on what I think are the best practices for XAML.&#160; So, without further ado here are my thoughts on XAML:</p>
<h2>Formatting</h2>
<p>First and foremost, I think formatting is the number one concern.&#160; </p>
<ul>
<li>Attributes should be on a separate line,</li>
<li>x:Name should come first,</li>
<li>and related attributes (such as HorizontalAlignment and VerticalAlignment) should be grouped.</li>
</ul>
<p>Take the below code blocks, Figure-1 and Figure-2, show the difference between having all the attributes on the same line versus on different lines.&#160; In my opinion, Figure-2 is much easier to digest than Figure-1.&#160; By having the x:Name first, you can quickly identify what the element is.&#160; Once you find the object you are looking for, you can then quickly identify related objects since they are grouped together (such as <font face="Courier New">RadiusX</font> and RadiusY, Width and Height, and HorizontalAlignment and VerticalAlignment).</p>
<p>The biggest complaint about Figure-2 is “wasted space”.&#160; The code inflates from 8 lines to 30; however, to Martin Fowler’s point, it’s not about you or the computer, it’s about other people being able to read and quickly assimilate to your code.</p>
<p><font face="Times New Roman" color="#c0c0c0" size="2">Figure-1</font>    <br /><a href="http://www.85turns.com/blog/wp-content/uploads/2009/02/image1.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="143" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image-thumb.png" width="596" border="0" /></a>&#160;</p>
<p><font face="Times New Roman" color="#c0c0c0" size="2">Figure-2</font>    <br /><a href="http://www.85turns.com/blog/wp-content/uploads/2009/02/image2.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="527" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image-thumb1.png" width="363" border="0" /></a> </p>
<h2>Naming conventions</h2>
<h3>Name everything</h3>
<p>Try to specify an x:Name attribute for every element in XAML.&#160; If nothing else, this will make you think if you really need the object.&#160; For example, at times it’s tempting to embed a panel within a panel to achieve a specific layout.&#160; In many instances I have caught myself doing this, mainly out of laziness.&#160; After refactoring I find that if I tweaked a margin or used a different kind of panel, there would have been no need for the extra panel.&#160; Forcing an x:Name on an object really makes you think of the purpose of that element.</p>
<h3>Describe elements</h3>
<p>Instead of pre or post-fixing element names, give them a descriptive name.&#160; Instead of:</p>
<ul>
<li>btnSubmit use SubmitButton,</li>
<li>grdContent use ContentPanel,</li>
<li>stkPnlNav use NavigationPanel.</li>
</ul>
<p>Programmers like using the pre-fix because you can quickly see all of the same type when using intellisense, and you can easily identify the type of an element.&#160; Admittedly, I come from this camp; however it’s time to change.&#160; A couple reasons for the change: 1.) designers will increasing be&#160; working in Blend and they are not going to be geeks like most of us and pre-fix with the type 2.)descriptive names are much easier to read and understand the cryptic typed names (think stkPnl=StackPanel or me=MediaElement).</p>
<p>Lastly, give all panels the same post-fix because you never know if you will have to change the type of a panel.&#160; I assure you, it’s an enormous pain, and large risk, to change the x:Name in a project.&#160; For example imagine having to change “BufferGrid” to “BufferCanvas” to “BufferStackPanel”.&#160; Not only do you have to change the XAML, you have to ensure all instances in the code are changed too.&#160; Better to go with the generic “BufferPanel” and be done with it.</p>
<h2>Disclaimer</h2>
<p>Best practices should be followed to the T; however, there are times when we’re in a crunch and the guidelines fall the way side.&#160; Best practices are designed to eliminate maintenance time and promote consistency.&#160; I am certainly guilty of not following the above guidelines, however it’s my goal to follow these consistently as possible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/02/09/xaml-guidelines-and-best-practices/feed/</wfw:commentRss>
		<slash:comments>26</slash:comments>
		</item>
		<item>
		<title>Silverlight and VOIP</title>
		<link>http://www.85turns.com/2009/02/04/silverlight-and-voip/</link>
		<comments>http://www.85turns.com/2009/02/04/silverlight-and-voip/#comments</comments>
		<pubDate>Wed, 04 Feb 2009 17:25:19 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/02/04/silverlight-and-voip/</guid>
		<description><![CDATA[Much like 3D is more like 2.5D so is VOIP through Silverlight.  TringMe has set up a compelling Silverlight prototype showing how to make a call using Silverlight.  They’re using Flash to handle the voice and audio, with Silverlight to passing the number, the call action, and hang up action.  It looks like Silverlight is [...]]]></description>
			<content:encoded><![CDATA[<p>Much like 3D is more like 2.5D so is VOIP through Silverlight.  <a href="http://tringme.com/">TringMe</a> has set up a compelling Silverlight prototype showing how to make a call using Silverlight.  They’re using Flash to handle the voice and audio, with Silverlight to passing the number, the call action, and hang up action.  It looks like Silverlight is calling the Flash object through a JavaScript layer.  This use of JavaScipt reminds me of the YouTube in Silverlight prototype.  The video controls were done in Silverlight, the video was Flash, and the interaction between them used the YouTube JavaScript library.</p>
<p>Until Silverlight has native mic and webcam support, this will have to do.  Here’s the demo (click the image).</p>
<p><a href="http://tringme.com/silverlightdemo/"><img style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" title="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/02/image.png" border="0" alt="image" width="260" height="155" /></a></p>
<p>Thanks to my PHP buddy, <a href="http://www.robertswarthout.com/" target="_blank">Robert Swarthout</a>, for telling me about this.</p>
<h3>Silverlight&#8217;s first VOIP application</h3>
<p>This TringMe prototype is not the first time VOIP has been done through a Silverlight interface.  Cynergy used Skype com objects to accomplish this.  <a href="http://www.cynergysystems.com/blogs/page/michaelwolf?entry=very_first_voip_silverlight_demo">Check out Mike Wolf&#8217;s post</a> for more deatails; very cool stuff.  (My favorite quote from Mike is: &#8220;Just because one platform doesn’t have feature A, you don’t have to drop it entirely.&#8221;)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/02/04/silverlight-and-voip/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>HSN.tv video player</title>
		<link>http://www.85turns.com/2009/01/23/hsntv-video-player/</link>
		<comments>http://www.85turns.com/2009/01/23/hsntv-video-player/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 16:18:08 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[hsn.tv]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://www.85turns.com/2009/01/23/hsntv-video-player/</guid>
		<description><![CDATA[I am proud to announce that the new version of HSN.tv is live!&#160; This is what has been keeping me busy for the past couple months.&#160; There were a number of Silverlight features that we pushed to the limit.&#160; One of the biggest wins was the use of the Command pattern and the integration of [...]]]></description>
			<content:encoded><![CDATA[<p>I am proud to announce that the new version of <a href="http://hsn.tv" target="_blank">HSN.tv</a> is live!&#160; This is what has been keeping me busy for the past couple months.&#160; There were a number of Silverlight features that we pushed to the limit.&#160; One of the biggest wins was the use of the Command pattern and the integration of analytics.&#160; Check it out:</p>
<p><a href="http://www.hsn.tv">http://www.hsn.tv</a></p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/01/image4.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="242" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/01/image-thumb.png" width="404" border="0" /></a> </p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/01/image5.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="242" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/01/image-thumb1.png" width="404" border="0" /></a> </p>
<p><a href="http://www.85turns.com/blog/wp-content/uploads/2009/01/image6.png"><img title="image" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="242" alt="image" src="http://www.85turns.com/blog/wp-content/uploads/2009/01/image-thumb2.png" width="404" border="0" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2009/01/23/hsntv-video-player/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>3D example in Silverlight</title>
		<link>http://www.85turns.com/2008/09/16/3d-example-in-silverlight/</link>
		<comments>http://www.85turns.com/2008/09/16/3d-example-in-silverlight/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 19:13:34 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[3d]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=149</guid>
		<description><![CDATA[Talking with my boy Ryan made me start thinking about trying new things in Silverlight&#8230;3D.  Here is an example of images in Z space.  I am working on getting a camera object implemented so you can zoom in and out on the objects.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.coreyschuman.com/Silverlight/Prototypes/FocalLength/FocalLengthTestPage.aspx"><img class="alignright size-medium wp-image-150" title="FocalLength" src="http://www.85turns.com/blog/wp-content/uploads/2008/09/ishot-4.png?w=300" alt="" width="300" height="210" /></a></p>
<p>Talking with my boy <a href="http://www.boostworthy.com/">Ryan</a> made me start thinking about trying new things in Silverlight&#8230;3D.  <a href="http://www.coreyschuman.com/Silverlight/Prototypes/FocalLength/FocalLengthTestPage.aspx">Here</a> is an example of images in Z space.  I am working on getting a camera object implemented so you can zoom in and out on the objects.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/09/16/3d-example-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create a video player in Silverlight 2 &#8211; Part 2</title>
		<link>http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/</link>
		<comments>http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/#comments</comments>
		<pubDate>Tue, 15 Apr 2008 02:15:45 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[buffering]]></category>
		<category><![CDATA[MediaElement]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[timer]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=56</guid>
		<description><![CDATA[In part 1 we covered setting up a very basic video player. In part 2 we will add Scrubbing the video wiring up volume, and muting. In future versions I will show how to display a buffer message, skin the controls, and how to work with media that&#8217;s not embedded in the xap. Scrubbing Add [...]]]></description>
			<content:encoded><![CDATA[<p>In <a title="http://simplesilverlight.wordpress.com/2008/04/02/create-a-video-player-silverlight-2-part-1/" href="http://simplesilverlight.wordpress.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">part 1</a> we covered setting up a very basic video player.  In part 2 we will add</p>
<ul>
<li>Scrubbing the video</li>
<li>wiring up volume,</li>
<li>and muting.</li>
</ul>
<p>In future versions I will show how to display a buffer message, skin the controls, and how to work with media that&#8217;s not embedded in the xap.</p>
<ol>
<li><strong>Scrubbing</strong>
<ul>
<li>Add a MouseLeftButtonDown and MouseLeftButtonUp events for the slider in the constructor.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderevents.png"><img class="alignnone size-full wp-image-58" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderevents.png?w=480" alt="Register MouseLeftButtonDown and MouseLeftButtonUp events for the slider" /></a><a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderevents.png"><br />
</a></li>
<li>Add a property to lock the scrubber while the mouse button is down.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-isscrubberlocked1.png"><img class="alignnone size-medium wp-image-74" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-isscrubberlocked1.png" alt="" /></a></li>
<li>In the MouseLeftButtonDown event, set the scrubber lock to true.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderleftbuttondown1.png"><img class="alignnone size-medium wp-image-73" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderleftbuttondown1.png?w=480" alt="" /></a></li>
<li>In the MouseLeftButtonUp event, release the lock on the scrubber and update the position of the video.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderleftbuttonup1.png"><img class="alignnone size-medium wp-image-72" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-sliderleftbuttonup1.png?w=480" alt="" /></a></li>
<li>Finally in the Tick event of the timer, prevent updating the position of the slider while the scrubber is locked.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-timertick1.png"><img class="alignnone size-medium wp-image-71" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-timertick1.png?w=480" alt="" /></a></li>
</ul>
</li>
<li><strong>Volume</strong>
<ul>
<li>XAML.  It important to set the Min to 0 and the Max to 1.  The MediaElements volume ranges from 0 to 1.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-xaml-slidervolume.png"><img class="alignnone size-full wp-image-70" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-xaml-slidervolume.png" alt="" /></a></li>
<li>Register the ValueChanged event in the constructor for the slider.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-volumevaluechangedreg.png"><img class="alignnone size-full wp-image-75" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-volumevaluechangedreg.png?w=480" alt="" /></a></li>
<li>Set the video&#8217;s volume to the value in the ValueChanged event.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-volumevaluechanged.png"><img class="alignnone size-full wp-image-69" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-volumevaluechanged.png?w=480" alt="" /></a></li>
<li>Set the initial position of the slider to the video&#8217;s volume.  You can either do this in the CurrentStateChanged event or the MediaOpened event of the MediaElement.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-setslidervolume.png"><img class="alignnone size-full wp-image-68" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-setslidervolume.png" alt="" /></a></li>
</ul>
</li>
<li><strong>Mute button</strong>
<ul>
<li>XAML, add a ToggleButton<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-xaml-togglemute.png"><img class="alignnone size-full wp-image-67" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-xaml-togglemute.png?w=480" alt="" /></a></li>
<li>Register the Checked and UnChecked events in the constuctor for the mute button.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-btnevents.png"><img class="alignnone size-medium wp-image-66" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-btnevents.png?w=480" alt="" /><br />
</a></li>
<li>Add a variable to store the previous volume.<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-previousvolume.png"><img class="alignnone size-full wp-image-65" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-previousvolume.png" alt="" /><br />
</a></li>
<li>Checked event<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-mutechecked.png"><img class="alignnone size-full wp-image-64" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-mutechecked.png" alt="" /><br />
</a></li>
<li>UnChecked event<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-muteunchecked.png"><img class="alignnone size-full wp-image-63" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-cs-muteunchecked.png" alt="" /></a></li>
</ul>
</li>
<li>Resulting player<br />
<a href="http://simplesilverlight.files.wordpress.com/2008/04/part2-final.png"><img class="alignnone size-full wp-image-76" src="http://simplesilverlight.files.wordpress.com/2008/04/part2-final.png?w=480" alt="" /></a></li>
</ol>
<p>Files:<br />
Instead of the whole project (because the video is embedded in the project), here are the two important pieces of this project</p>
<p><a title="http://www.coreyschuman.com/Silverlight/Blogfiles/videoplayer/Page.xaml.txt" href="http://www.coreyschuman.com/Silverlight/Blogfiles/videoplayer/Page.xaml.txt">XAML</a></p>
<p><a title="http://www.coreyschuman.com/Silverlight/Blogfiles/videoplayer/Page.xaml.cs.txt" href="http://www.coreyschuman.com/Silverlight/Blogfiles/videoplayer/Page.xaml.cs.txt">C#</a></p>
<h2><span style="color:#800000;">UPDATE</span></h2>
<p>If you are having problems with the Slider not recoginzing MouseLeftButtonUp or MouseLeftButtonDown events, check out the <a href="http://simplesilverlight.wordpress.com/2008/09/09/video-slider-control/"><strong>VideoSlider</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/feed/</wfw:commentRss>
		<slash:comments>23</slash:comments>
		</item>
		<item>
		<title>Create a video player in Silverlight 2 &#8211; Part 1</title>
		<link>http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/</link>
		<comments>http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 03:37:36 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[MediaElement]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[Video player]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=46</guid>
		<description><![CDATA[Creating a video player in Silverlight is pretty simple. The MediaElement does all the heavy lifting, all you need to do is wire up a UI and you have a basic Video player. Here is a tutorial on how to create a simple video player from scratch using Silverlight 2. Create a Silverlight application Add [...]]]></description>
			<content:encoded><![CDATA[<p>Creating a video player in Silverlight is pretty simple.  The MediaElement does all the heavy lifting, all you need to do is wire up a UI and you have a basic Video player.  Here is a tutorial on how to create a simple video player from scratch using Silverlight 2.</p>
<ol>
<li>Create a Silverlight application</li>
<li>Add a video to the project.  This is for testing purposes only.  Later in part 2 we will use a streaming video.</li>
<li>Add a MediaElement and a Toggle button for Play/Pause of the video.<strong>XAML</strong><br />
<a title="XAML Play Pause toggle button" href="http://simplesilverlight.files.wordpress.com/2008/04/part1-xaml-playpause1.png"><img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-xaml-playpause1.png" alt="XAML Play Pause toggle button" /></a></p>
<p><strong>C#</strong><br />
<a title="C# Play Pause Toggle button" href="http://simplesilverlight.files.wordpress.com/2008/04/part1-cs-playpausebutton.png"><img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-cs-playpausebutton.png" alt="C# Play Pause Toggle button" /></a></li>
<li>Add a Slider to show the position of the video.  To show the progress of the video on the slider, we will need to create a DispatcherTimer.  On the Tick event we will update the value of the slider.  In this example I have set the value of the Tick to 50 milliseconds.  There is minor jumping; if you want to get seamless indicator movment try going under 41 milliseconds.  We also need to Start and Stop the timer.  I am doing this on CurrentStateChanged event of the MediaElement.<strong>XAML</strong><br />
<a title="XAML slider" href="http://simplesilverlight.files.wordpress.com/2008/04/part1-xaml-scrubber.png"><img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-xaml-scrubber.png" alt="XAML slider" /></a></p>
<p><strong>C#</strong><br />
<a title="C# Scrubber" href="http://simplesilverlight.files.wordpress.com/2008/04/part1-scrubber.png"><img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-scrubber.png" alt="C# Scrubber" /></a></li>
<li>Add a TextBlock to show the exact position of the video.  To update the text, I am adding this to the Tick event of the timer.<strong>XAML</strong><br />
<a title="XAML Video position text" href="http://simplesilverlight.files.wordpress.com/2008/04/part1-xaml-duration.png"><img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-xaml-duration.png" alt="XAML Video position text" /></a></p>
<p><strong>C#</strong><br />
<a title="C# Video position text" href="http://simplesilverlight.files.wordpress.com/2008/04/part1-duration.png"><img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-duration.png" alt="C# Video position text" /></a></li>
<li>Screen shot of the player at the end of Part 1<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/04/part1-final.png" alt="Part 1 screen shot" /></li>
</ol>
<p><strong>Links</strong><br />
<a title="http://silverlight.peterpancomplex.net/zip/VideoPlayer.zip" href="http://silverlight.peterpancomplex.net/zip/VideoPlayer.zip">Source</a> (11Mb because of the WMV)<br />
<a title="http://simplesilverlight.wordpress.com/2008/04/15/create-a-video-player-silverlight-2-part-2/" href="http://simplesilverlight.wordpress.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">Part 2 of how to Create a video player in Silverlight 2</a></p>
<h2><span style="color:#800000;">UPDATE</span></h2>
<p>If you are having problems with the Slider not recoginzing MouseLeftButtonUp or MouseLeftButtonDown events, check out the <a href="http://simplesilverlight.wordpress.com/2008/09/09/video-slider-control/"><strong>VideoSlider</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/feed/</wfw:commentRss>
		<slash:comments>29</slash:comments>
		</item>
		<item>
		<title>Atlanta Code Camp</title>
		<link>http://www.85turns.com/2008/03/31/atlanta-code-camp/</link>
		<comments>http://www.85turns.com/2008/03/31/atlanta-code-camp/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 15:27:59 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[intro]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[references]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=44</guid>
		<description><![CDATA[My first code camp is over and done with. I got a chance to meet a lot of great people who are as interested and enthusiastic about Silverlight as I am. As promised here are the presentation and the code from my presentation on Saturday. A couple notes: the presentation is saved as a pptx, [...]]]></description>
			<content:encoded><![CDATA[<p>My first code camp is over and done with.  I got a chance to meet a lot of great people who are as interested and enthusiastic about Silverlight as I am.  As promised here are the presentation and the code from my presentation on Saturday.</p>
<p>A couple notes: the presentation is saved as a pptx, so e-mail or leave me a comment if you would like a ppt.  As for the code, make sure you change the port the xml file is coming from.  This will be in the Page.xaml.cs</p>
<p>Presentation (<a href="http://www.peakeeng.com/Silverlight/AtlantaCodeCamp.zip" title="http://www.peakeeng.com/Silverlight/AtlantaCodeCamp.zip">zip</a>)<br />
Code (<a href="http://www.peakeeng.com/Silverlight/Introduction%20to%20Silverlight%202.zip" title="http://www.peakeeng.com/Silverlight/Introduction to Silverlight 2.zip">zip</a>)</p>
<p><b>References</b></p>
<p><b></b>Silverlight 1.0 gallery<br />
<a href="http://silverlight.net/community/gallerydetail.aspx?cat=3&amp;sort=2" title="http://silverlight.net/community/gallerydetail.aspx?cat=3&amp;sort=2">http://silverlight.net/community/gallerydetail.aspx?cat=3&amp;sort=2 </a></p>
<p>Microsoft Developer reference poster<br />
<a href="http://brad_abrams.members.winisp.net/Projects/Mix08SL2Poster/Silverlight2PosterMIX08.png" title="http://brad_abrams.members.winisp.net/Projects/Mix08SL2Poster/Silverlight2PosterMIX08.png">http://brad_abrams.members.winisp.net/Projects/Mix08SL2Poster/Silverlight2PosterMIX08.png </a></p>
<p>XAML overview<br />
<a href="http://msdn2.microsoft.com/en-us/library/ms752059.aspx" title="http://msdn2.microsoft.com/en-us/library/ms752059.aspx">http://msdn2.microsoft.com/en-us/library/ms752059.aspx </a></p>
<p>Silverlight 2 controls:<br />
<a href="http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html" title="http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html">http://silverlight.net/Samples/2b1/SilverlightControls/run/default.html</a></p>
<p>Scott Guthries first look at Silverlight 2<br />
<a href="http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx" title="http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx">http://weblogs.asp.net/scottgu/archive/2008/02/22/first-look-at-silverlight-2.aspx</a></p>
<p>MSDN Silverlight<br />
<a href="http://msdn2.microsoft.com/en-us/library/cc303041.aspx" title="http://msdn2.microsoft.com/en-us/library/cc303041.aspx">http://msdn2.microsoft.com/en-us/library/cc303041.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/31/atlanta-code-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Data visualizations</title>
		<link>http://www.85turns.com/2008/03/25/data-visualizations/</link>
		<comments>http://www.85turns.com/2008/03/25/data-visualizations/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 02:56:26 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[data visualizatoin.]]></category>
		<category><![CDATA[datagrid]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=41</guid>
		<description><![CDATA[Today I recieved an e-mail to The Best Tools for Visualization.  For the past five years I have worked in a world where there is really only one way to display data, THE GRID.  To be exact, the .NET DataGrid.  This control alone has employed many developers and has allowed them to make a living [...]]]></description>
			<content:encoded><![CDATA[<p>Today I recieved an e-mail to The <a href="http://www.readwriteweb.com/archives/the_best_tools_for_visualization.php" title="http://www.readwriteweb.com/archives/the_best_tools_for_visualization.php">Best Tools for Visualization</a>.  For the past five years I have worked in a world where there is really only one way to display data, THE GRID.  To be exact, the .NET DataGrid.  This control alone has employed many developers and has allowed them to make a living (remember <a href="http://www.datagridgirl.com/" title="http://www.datagridgirl.com/">The DataGrid Girl</a>?).</p>
<p>These application have pushed the limits on how we think and view data.  With Silverlight we have the opputunity join the data visualization revolution.  It&#8217;s time to get out of the mindset of writing a stored procedures and hooking them to a datagrids.  Challenge yourself and your users.</p>
<p>Over the next few weeks I will be working on creating a data visualization project in Silverlight, and I will use the <a href="http://simplesilverlight.wordpress.com/projects/" title="http://simplesilverlight.wordpress.com/projects/">Animation Engine </a>I have created as the basis for motion.</p>
<p>Stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/25/data-visualizations/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Positioning in Silverlight 2</title>
		<link>http://www.85turns.com/2008/03/19/positioning-in-silverlight-2/</link>
		<comments>http://www.85turns.com/2008/03/19/positioning-in-silverlight-2/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 21:08:34 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Transforms]]></category>
		<category><![CDATA[x]]></category>
		<category><![CDATA[XAML]]></category>
		<category><![CDATA[y]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=38</guid>
		<description><![CDATA[A common mistake in Silverlight is for people to use the Canvas.Left and Canvas.Top property when positioning elements.  In Silverlight 2, there is a push towards a relative positioning model.  This makes the Margin, HorizontalAlignment, and VerticalAlignment very important (for all you CSS people the Margin starts on the Left and goes clockwise).  So, how [...]]]></description>
			<content:encoded><![CDATA[<p>A common mistake in Silverlight is for people to use the Canvas.Left and Canvas.Top property when positioning elements.  In Silverlight 2, there is a push towards a relative positioning model.  This makes the Margin, HorizontalAlignment, and VerticalAlignment very important (for all you CSS people the Margin starts on the Left and goes clockwise).  So, how do you position, move, or animate elements?  Where is the X and Y?  You can find them in the <b>TranslateTransform</b> which is part of the <b>TransformGroup</b> which is part of the <b>RenderTransform</b>.</p>
<p><b>XAML </b>(see below for this code to copy)<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/03/transforms.png" alt="Transform group" /><br />
This is a pain to access from C#.  You have to access the TranslateTransform through the Children collection using the index.  What happens if you switch the positions of the Transforms in XAML?  Your code will fail.  Here is the code to access X and Y through C# (again, see below for code to copy).<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/03/transforms_cs.png" alt="C Sharp translate transform" /><br />
So my question: Why not add the X, Y, ScaleX, and ScaleY to the UIElement?  This would eliminate the need to go through multiple castings in C#, it would prevent index failures if you change your transforms in XAML, and it would eliminate the misuse of the Canvas.Left and Canvas.Top properties.</p>
<p>Code to copy:</p>
<p>&lt;Grid x:Name=&#8221;LayoutRoot&#8221; Background=&#8221;White&#8221;&gt;<br />
&lt;Grid.RenderTransform&gt;<br />
&lt;TransformGroup&gt;<br />
&lt;TranslateTransform X=&#8221;0&#8243; Y=&#8221;0&#8243; /&gt;<br />
&lt;ScaleTransform ScaleX=&#8221;1&#8243; ScaleY=&#8221;0&#8243; /&gt;<br />
&lt;RotateTransform Angle=&#8221;0&#8243; /&gt;<br />
&lt;SkewTransform AngleX=&#8221;0&#8243; AngleY=&#8221;0&#8243; /&gt;<br />
&lt;/TransformGroup&gt;<br />
&lt;/Grid.RenderTransform&gt;<br />
&lt;/Grid&gt;</p>
<p><img src="/Users/corey/AppData/Local/Temp/moz-screenshot.jpg" />             ((LayoutRoot.RenderTransform as TransformGroup).Children[0] as TranslateTransform).X;<br />
((LayoutRoot.RenderTransform as TransformGroup).Children[0] as TranslateTransform).Y;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/19/positioning-in-silverlight-2/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Set the source for an image from C#</title>
		<link>http://www.85turns.com/2008/03/16/set-the-source-for-an-image-from-c/</link>
		<comments>http://www.85turns.com/2008/03/16/set-the-source-for-an-image-from-c/#comments</comments>
		<pubDate>Sun, 16 Mar 2008 23:24:34 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Image]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=33</guid>
		<description><![CDATA[In Silverlight, there are two ways to set the source for an image. image.SetValue(Image.SourceProperty,value); image.Source = new BitmapImage(new Uri(value, UriKind.Absolute)); For the second option you will need to include the following namespace: using System.Windows.Media.Imaging;.]]></description>
			<content:encoded><![CDATA[<p>In Silverlight, there are two ways to set the source for an image.</p>
<ol>
<li>image.SetValue(Image.SourceProperty,value);</li>
<li>image.Source = new BitmapImage(new Uri(value, UriKind.Absolute));</li>
</ol>
<p>For the second option you will need to include the following namespace: using System.Windows.Media.Imaging;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/16/set-the-source-for-an-image-from-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Animation engine for Silverlight</title>
		<link>http://www.85turns.com/2008/03/14/animation-engine-for-silverlight/</link>
		<comments>http://www.85turns.com/2008/03/14/animation-engine-for-silverlight/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 04:05:08 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=32</guid>
		<description><![CDATA[Just added Animations for Width and Height.  Check out the code and the example.  For more information here is the initial post.   I will add more documentation after getting a few more animations in the engine. Known issues: After the animation of Width, the width property doesn&#8217;t get set.  Same with Height.]]></description>
			<content:encoded><![CDATA[<p>Just added Animations for Width and Height.  Check out the <a href="http://silverlight.peterpancomplex.net/zip/slanimator2.zip" title="http://silverlight.peterpancomplex.net/zip/slanimator2.zip">code </a>and the <a href="http://www.peakeeng.com/Silverlight/SLAnimator/ClientBin/TestPage.html" title="http://www.peakeeng.com/Silverlight/SLAnimator/ClientBin/TestPage.html">example</a>.  For more information here is <a href="http://simplesilverlight.wordpress.com/2008/03/14/animate-silverlight-2-object-from-1-line-of-code/" title="http://simplesilverlight.wordpress.com/2008/03/14/animate-silverlight-2-object-from-1-line-of-code/">the initial post.</a>   I will add more documentation after getting a few more animations in the engine.</p>
<p>Known issues:<br />
After the animation of Width, the width property doesn&#8217;t get set.  Same with Height.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/14/animation-engine-for-silverlight/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reusing a Storyboard</title>
		<link>http://www.85turns.com/2008/03/14/reusing-a-storyboard/</link>
		<comments>http://www.85turns.com/2008/03/14/reusing-a-storyboard/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 02:46:33 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[storyboard]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=31</guid>
		<description><![CDATA[It is possible to reuse a storyboard.  Make sure to stop the storyboard before you set a new target property.  Thanks Tom for pointing this out. XAML     &#60;Canvas x:Name=&#8221;LayoutRoot&#8221; Background=&#8221;White&#8221;&#62; &#60;Button Height=&#8221;20&#8243; Width=&#8221;120&#8243; Canvas.Left=&#8221;0&#8243; Canvas.Top=&#8221;0&#8243; Content=&#8221;Button&#8221; x:Name=&#8221;btnTest&#8221;/&#62; &#60;Rectangle x:Name=&#8221;Fred&#8221; Height=&#8221;30&#8243; Width=&#8221;30&#8243; Fill=&#8221;Aquamarine&#8221; Canvas.Top=&#8221;50&#8243;/&#62; &#60;Rectangle x:Name=&#8221;Wilma&#8221; Height=&#8221;30&#8243; Width=&#8221;30&#8243; Fill=&#8221;OrangeRed&#8221; Canvas.Top=&#8221;150&#8243;/&#62; &#60;/Canvas&#62; C#         void Page_Loaded(object [...]]]></description>
			<content:encoded><![CDATA[<p>It is possible to reuse a storyboard.  Make sure to stop the storyboard before you set a new target property.  Thanks Tom for pointing this out.</p>
<p>XAML</p>
<p><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">     </span><span style="font-size:10pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">Canvas</span><span style="font-size:10pt;color:red;font-family:'Courier New';"> x</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">:</span><span style="font-size:10pt;color:red;font-family:'Courier New';">Name</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;LayoutRoot&#8221;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Background</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">=&#8221;White&#8221;&gt;<br />
</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">Button</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Height</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;20&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Width</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;120&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Canvas.Left</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;0&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Canvas.Top</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;0&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Content</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;Button&#8221;</span><span style="font-size:10pt;color:red;font-family:'Courier New';"> x</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">:</span><span style="font-size:10pt;color:red;font-family:'Courier New';">Name</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">=&#8221;btnTest&#8221;/&gt;<br />
</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">Rectangle</span><span style="font-size:10pt;color:red;font-family:'Courier New';"> x</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">:</span><span style="font-size:10pt;color:red;font-family:'Courier New';">Name</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;Fred&#8221;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Height</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;30&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Width</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;30&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Fill</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;Aquamarine&#8221;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Canvas.Top</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">=&#8221;50&#8243;/&gt;<br />
</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">&lt;</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">Rectangle</span><span style="font-size:10pt;color:red;font-family:'Courier New';"> x</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">:</span><span style="font-size:10pt;color:red;font-family:'Courier New';">Name</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;Wilma&#8221;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Height</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;30&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Width</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;30&#8243;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Fill</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">=&#8221;OrangeRed&#8221;</span><span style="font-size:10pt;color:red;font-family:'Courier New';">  Canvas.Top</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">=&#8221;150&#8243;/&gt;<br />
</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">&lt;/</span><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">Canvas</span><span style="font-size:10pt;color:blue;font-family:'Courier New';">&gt;</span><br />
C#</p>
<p class="MsoNormal"><span style="font-size:10pt;color:blue;font-family:'Courier New';">         void</span><span style="font-size:10pt;font-family:'Courier New';">  Page_Loaded(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">RoutedEventArgs</span> e)<br />
{<br />
_storyboard =  <span style="color:blue;">new</span> <span style="color:#2b91af;">Storyboard</span>();<br />
_dx = <span style="color:blue;">new</span> <span style="color:#2b91af;">DoubleAnimation</span>();<br />
_dx.From =  0;<br />
_dx.To =  250;<br />
_dx.Duration =  <span style="color:blue;">new</span> <span style="color:#2b91af;">Duration</span>(<span style="color:blue;">new</span>  <span style="color:#2b91af;">TimeSpan</span>(0,0,3));<br />
_dx.AutoReverse  = <span style="color:blue;">true</span>;<br />
_dx.RepeatBehavior = <span style="color:#2b91af;">RepeatBehavior</span>.Forever;</span></p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'Courier New';">            <span style="color:#2b91af;">Storyboard</span>.SetTargetName(_dx, <span style="color:#a31515;">&#8220;Fred&#8221;</span>);<br />
<span style="color:#2b91af;">Storyboard</span>.SetTargetProperty(_dx, <span style="color:#a31515;">&#8220;(Rectangle.Width)&#8221;</span>);<br />
_storyboard.Children.Add(_dx);<br />
LayoutRoot.Resources.Add(_storyboard);<br />
_storyboard.Begin();<br />
}</span></p>
<p class="MsoNormal">&nbsp;</p>
<p class="MsoNormal"><span style="font-size:10pt;font-family:'Courier New';">        <span style="color:blue;">void</span> btnTest_Click(<span style="color:blue;">object</span> sender, <span style="color:#2b91af;">RoutedEventArgs</span> e)<br />
{<br />
<b>             _storyboard.Stop();</b><br />
<span style="color:#2b91af;">Storyboard</span>.SetTargetName(_dx, <span style="color:#a31515;">&#8220;Wilma&#8221;</span>);<br />
_storyboard.Begin();<br />
}</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/14/reusing-a-storyboard/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Animate Silverlight 2 object from 1 line of code</title>
		<link>http://www.85turns.com/2008/03/14/animate-silverlight-2-object-from-1-line-of-code/</link>
		<comments>http://www.85turns.com/2008/03/14/animate-silverlight-2-object-from-1-line-of-code/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 02:35:34 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=30</guid>
		<description><![CDATA[In a previous post about how to create animations dynamically, I showed how to add StoryBoards from C#. I have extracted this logic into a class called SLAnimator. This allows you to do an animation from one line code, and a nice thing about this approach is it still uses the built in Silverlight Animation [...]]]></description>
			<content:encoded><![CDATA[<p>In a previous post about <a href="http://simplesilverlight.wordpress.com/2008/03/09/how-to-dynamically-create-animations-from-c-in-silverlight/" title="http://simplesilverlight.wordpress.com/2008/03/09/how-to-dynamically-create-animations-from-c-in-silverlight/">how to create animations dynamically</a>, I showed how to add StoryBoards from C#.  I have extracted this logic into a class called SLAnimator.  This allows you to do an animation from one line code, and a nice thing about this approach is it still uses the built in Silverlight Animation system.</p>
<p>Here is an example of the code to call the animation.<br />
<code>SLAnimator.Animate(this, rect, 100, 100, 100,1,1);</code><br />
Parameters:</p>
<ul>
<li>Container element</li>
<li>UIElement to animate</li>
<li>Time of animation in milliseconds</li>
<li>X of destination</li>
<li>Y of destination</li>
<li>ScaleX</li>
<li>ScaleY</li>
</ul>
<p>This animation API is at it&#8217;s infancy, so I will continue updating as time permits.  Feel free to download the class and give me your feed back.</p>
<p>Enjoy!</p>
<p>Links:<br />
<a href="http://silverlight.peterpancomplex.net/zip/SLAnimator.zip" title="http://silverlight.peterpancomplex.net/zip/SLAnimator.zip">Download the source</a><br />
<a href="http://www.peakeeng.com/Silverlight/SLAnimator/ClientBin/TestPage.html" title="http://www.peakeeng.com/Silverlight/SLAnimator/ClientBin/TestPage.html">Working example</a></p>
<p>   <a href="http://go.microsoft.com/fwlink/?LinkID=108182"><br />
      <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight"><br />
  </a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/14/animate-silverlight-2-object-from-1-line-of-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Consume a JSON object in Silverlight</title>
		<link>http://www.85turns.com/2008/03/12/consume-a-json-object-in-silverlight/</link>
		<comments>http://www.85turns.com/2008/03/12/consume-a-json-object-in-silverlight/#comments</comments>
		<pubDate>Wed, 12 Mar 2008 02:49:50 +0000</pubDate>
		<dc:creator>Corey</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DataContractJsonSerializer]]></category>
		<category><![CDATA[deserialize]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[Silverlight]]></category>

		<guid isPermaLink="false">http://simplesilverlight.wordpress.com/?p=25</guid>
		<description><![CDATA[Here is how to consume a JSON object in Silverlight 2. Start with a JSON object: var Person = { "firstName": "John", "lastName": "Smith", "address": { "streetAddress": "21 2nd Street", "city": "New York", "state": "NY", "postalCode": 10021 } } Create an entry point into Silverlight. You will need to add namespace System.Windows.Browser. Next add C# [...]]]></description>
			<content:encoded><![CDATA[<p>Here is how to consume a JSON object in Silverlight 2.</p>
<ol>
<li>Start with a JSON object:<br />
<code>var Person = {<br />
"firstName": "John",<br />
"lastName": "Smith",<br />
"address": {<br />
"streetAddress": "21 2nd Street",<br />
"city": "New York",<br />
"state": "NY",<br />
"postalCode": 10021<br />
}<br />
}</code></li>
<li>Create an entry point into Silverlight.  You will need to add namespace <b>System.Windows.Browser</b>.<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/03/json_htmlbridge.png" alt="JSON Html Bridge" /></li>
<li>Next add C# classes to mirror the JSON object.  It&#8217;s important to make sure the variables in the class are exactly how they appear in the JSON object, this is case sensitive.<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/03/json_csclasses.png" alt="JSON C# classes" /></li>
<li>Before adding the deserializing code, add references in your project for <b>System.Runtime.Serialization</b>, <b>System.ServiceModel</b>, and <b>System.ServiceModel.Web</b>.<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/03/json_addreferences.png" alt="Add reference" /></li>
<li>Now that the proper references are made in the project, we can finally write the code that deserializes the JSON object.  The class that does all the magic is <b>System.Runtime.Serialization.Json.DataContractJsonSerializer</b>.<br />
<img src="http://simplesilverlight.files.wordpress.com/2008/03/json_desrializer.png" alt="Code for deserialzing a json object in silverlight" /></li>
<li>Finally add some HTML and JavaScript to make this work. (To get the JSON object in a serialized form I am using the Prototype JavaScript library.  That is where you&#8217;ll find the function Object.toJSON().  There are other ways to serialize a JSON object.  Notably, if you are using the AJAX ASP.NET library, there is a function in there that does exactly the same thing as this call.)JavaScript<br />
<code>function sendJSON(){ document.getElementById("SL").Content.Bridge.SendJSON(Object.toJSON(Person)); }</code><br />
HTML<br />
<code>&lt;input type="button" value="send JSON to SL" onclick="sendJSON()" id="btnSendJSON" /&gt;</code></li>
</ol>
<p><b>Links</b><br />
<a href="http://www.peakeeng.com/Silverlight/JsonToSilverlight/index.html" title="http://www.peakeeng.com/Silverlight/JsonToSilverlight/index.html"> See this example in action</a>.<br />
<a href="http://silverlight.peterpancomplex.net/zip/JsonToSilverlight.zip" title="http://silverlight.peterpancomplex.net/zip/JsonToSilverlight.zip"> Download the Source</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.85turns.com/2008/03/12/consume-a-json-object-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

