<?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>Elegant Code &#187; cschuman</title>
	<atom:link href="http://elegantcode.com/author/cschuman/feed/" rel="self" type="application/rss+xml" />
	<link>http://elegantcode.com</link>
	<description></description>
	<lastBuildDate>Tue, 16 Mar 2010 04:00:13 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Open Source Silverlight video players</title>
		<link>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</link>
		<comments>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 07:28:17 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[web]]></category>
		<category><![CDATA[Open Source Software]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/</guid>
		<description><![CDATA[ Lately I&#8217;ve been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (link 1 &#124; link 2), have a button to play, a way to control the volume, a [...]]]></description>
			<content:encoded><![CDATA[<p><a style="float: right" href="http://elegantcode.com/wp-content/uploads/2010/01/image4.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://elegantcode.com/wp-content/uploads/2010/01/image_thumb4.png" width="150" height="240" /></a> Lately I&#8217;ve been spending a lot of time in the Silverlight video space.&#160; Both with writing the video chapter for my Silverlight 4 book as well as at work.&#160; Creating a basic video player is straight forward (<a href="http://www.85turns.com/2008/04/02/create-a-video-player-silverlight-2-part-1/">link 1</a> | <a href="http://www.85turns.com/2008/04/15/create-a-video-player-silverlight-2-part-2/">link 2</a>), have a button to play, a way to control the volume, a scrubber to show the position of playback, and of course an area to view the video.&#160; </p>
<p>Once you get beyond the basic requirements, the “basic video player” becomes very involved.&#160; A few questions that will need attention are: </p>
<ul>
<li>“How do you handler markers?” </li>
<li>“How is streaming video handled?” </li>
<li>“What do you do an an error?” </li>
<li>“What’s the strategy for buffering?” </li>
<li>“Can the video player support Smooth Streaming content?” (this is a whole different conversation) </li>
<li>“How does the video player handle Closed captioning?” </li>
</ul>
<p>And on and on the list goes.&#160; At some point (hopefully in the analysis phase) you should ask is it better to build or buy.&#160; If you decide to build, give me a call <img src='http://elegantcode.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> , but before you do I would encourage you to take a look at the following open-source (free) Silverlight video player options.&#160; If nothing else, these players are great place to start.</p>
<p>I’ll start off with the three best options, then highlight other projects I am less familiar with.</p>
<h3>Silverlight Media Framework (SMF)</h3>
<p><a href="http://smf.codeplex.com/">http://smf.codeplex.com/</a></p>
<p>This is so much more than a video player, it’s an entire framework.&#160; Developed by <a href="http://www.vertigo.com/">Vertigo</a> in coordination with Microsoft, SMF has been used on the largest, most watched, Silverlight video players to date.&#160; Wimbledon, NFL’s Sunday Night Football, PDC live keynote, and the NBC’s Vancouver Olympics video players, to name a few, all use SMF.&#160; To say it’s robust would be an understatement.</p>
<p>Other than the standard video player controls, here are additional highlights of SMF:</p>
<ul>
<li>Smooth Streaming support – includes the <strong>Microsoft.Web.Media.SmoothStreaming.dll</strong> </li>
<li>Great base classes like <strong>MergeableCollection</strong>, <strong>SimpleEventArgs</strong> and <strong>ObservableObject</strong> </li>
<li>A light weight data project </li>
<li>Logging </li>
<li>Blendability – the player is easily skinned </li>
<li>InStream markers </li>
<li>Bitrate – the ability to show bitrate </li>
</ul>
<p>For a more detailed list of features, and the code, check out SMF’s site.</p>
<h3>Silverlight Video Player</h3>
<p><a href="http://slvideoplayer.codeplex.com/">http://slvideoplayer.codeplex.com/</a></p>
<p>If you have ever watched a video on <a href="http://channel9.msdn.com/">Channel 9</a> (if you haven’t check out <a href="http://channel9.msdn.com/shows/SilverlightTV/">Silverlight TV</a>) the player being used is this video player.&#160; It was developed by <a href="http://timheuer.com/blog/">Tim Heuer</a> (Microsoft) and <a href="http://joel.neubeck.net/">Joel Nuebeck</a> (Silverlight MVP).&#160; Although SVP does not the feature set the SMF player has, this is still a solid and proven video player.&#160; It’s is probably the best option for a standard, light weight, feature rich video player.</p>
<h3>Silverlight HyperVideo player (HVP)</h3>
<p><a title="http://slhvp.com/" href="http://slhvp.com/">http://slhvp.com/</a></p>
<p>A new video player to the scene is the Silverlight Hyper-Video Player (HVP).&#160; This offering is from <a href="http://blogs.silverlight.net/blogs/jesseliberty/">Jesse Liberty</a> (Microsoft) and the Community.&#160; Targeting Silverlight 4, HVP takes advantage of the MEF framework and is rooted in best development practices.&#160; Although the project is young, there is a lot of traction and Jesse is doing an amazing job of documenting each step.&#160; Keep on eye on HVP as this maybe the most scalable offering.</p>
<h3>Others</h3>
<p>The above three video players I have personally used, dug through the code, and/or evaluated.&#160; The following projects I am not as familiar with, but could be possible options for your scenario:</p>
<p><strong>Sharepoint video player</strong> &#8211; <a href="http://svp.codeplex.com/">http://svp.codeplex.com/</a></p>
<p><strong>Silverlight Media Player </strong><a href="http://silverlight30.codeplex.com/">http://silverlight30.codeplex.com/</a></p>
<p><strong>xLite player </strong>- <a href="http://xliteplayer.codeplex.com/">http://xliteplayer.codeplex.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2010/01/22/open-source-silverlight-video-players/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Silverlight 4 WebCam &#8211; at a glance</title>
		<link>http://elegantcode.com/2009/11/20/silverlight-4-webcam-a-quick-glance/</link>
		<comments>http://elegantcode.com/2009/11/20/silverlight-4-webcam-a-quick-glance/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 10:08:12 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[Esoterica]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/11/20/silverlight-4-webcam-a-quick-glance/</guid>
		<description><![CDATA[WebCam support in Silverlight 4 is a much anticipated feature, and probably didn’t come as much of a surprise.&#160; It’s relatively simple to enable this feature.&#160; The below example shows a simple UI with the code to enable the webcam.&#160; This post does not cover multiple webcams, however calling CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices returns a list of all [...]]]></description>
			<content:encoded><![CDATA[<p>WebCam support in Silverlight 4 is a much anticipated feature, and probably didn’t come as much of a surprise.&#160; It’s relatively simple to enable this feature.&#160; The below example shows a simple UI with the code to enable the webcam.&#160; This post does not cover multiple webcams, however calling <strong>CaptureDeviceConfiguration.GetAvailableVideoCaptureDevices</strong> returns a list of all available webcams.</p>
<p>First create a simple UI (a <strong>Rectangle</strong> and a <strong>Button</strong>).</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/11/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://elegantcode.com/wp-content/uploads/2009/11/image_thumb3.png" width="600" height="320" /></a> </p>
<p>Add an event to the button click event.&#160; The logic looks like this:</p>
<ul>
<li>Get a handle on your video capture device using <strong>CaptureDeviceConfiguration</strong>. </li>
<li>Request access to the device with <strong>CaptureDeviceConfiguration.RequestDeviceAccess()</strong>. </li>
<li>If the user clicks Yes, then create a <strong>CaptureSource</strong> object and set the <strong>VideoCaptureDevice </strong>to the selected webcam. </li>
<li>Create a <strong>VideoBrush</strong> </li>
<li>Set the Source of the <strong>VideoBrush</strong> </li>
<li>Start the webcam </li>
<li>Paint the Rectangle (this could be anything that takes a Brush) </li>
</ul>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/11/image4.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://elegantcode.com/wp-content/uploads/2009/11/image_thumb4.png" width="600" height="350" /></a> </p>
<p>Next step, F5 (run your app).&#160; You’ll be looking at a blank screen with a button.&#160; After clicking the button, a box appears prompting the user to allow access to the webcam and microphone.&#160; Click Yes, since after all that is our goal <img src='http://elegantcode.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/11/image5.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://elegantcode.com/wp-content/uploads/2009/11/image_thumb5.png" width="564" height="217" /></a> </p>
<p><strong>Voilà!!</strong> You are now looking at yourself. Now you can do all sorts of fun web cam stuff.&#160; Enjoy.</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/11/image6.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://elegantcode.com/wp-content/uploads/2009/11/image_thumb6.png" width="505" height="531" /></a> </p>
<h3>Tip</h3>
<p>After running the above app, I noticed it was <em>backwards</em>.&#160; Meaning when I moved left my face on the screen moved to my right.&#160; Maybe it’s just me, but my brain was not happy about this.&#160; Instead, I wanted the app to respond like a mirror.&#160; To do this was a quick fix; simply <strong>Flip</strong> the Rectangle on the X axis.&#160; Here is the menu in Blend to do this:</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/11/image7.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://elegantcode.com/wp-content/uploads/2009/11/image_thumb7.png" width="262" height="147" /></a> </p>
<h3>More info</h3>
<p>For more information, Tim Heuer has a great video covering Web cam and microphone support in detail: <a href="http://silverlight.net/learn/videos/all/access-web-camera-microphone/">http://silverlight.net/learn/videos/all/access-web-camera-microphone/</a></p>
<p> <a href="http://silverlight.net/learn/videos/all/access-web-camera-microphone/"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/11/20/silverlight-4-webcam-a-quick-glance/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Silverlight tip &#8211; Dynamic TextBlock</title>
		<link>http://elegantcode.com/2009/09/14/silverlight-tip-dynamic-textblock/</link>
		<comments>http://elegantcode.com/2009/09/14/silverlight-tip-dynamic-textblock/#comments</comments>
		<pubDate>Mon, 14 Sep 2009 22:13:51 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[Esoterica]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/09/14/silverlight-tip-dynamic-textblock/</guid>
		<description><![CDATA[ 
Problem: You need text to dynamically add elipses, &#34;&#8230;&#34;,&#160; to the end of a sentence.&#160; The difficulty is how do you detect the actual length of the string.&#160; All characters are not created the same.&#160; Ten i’s != ten m’s.
Solution: Robby Ingebretsen at NerdPlusArt.com (and of Kaxaml fame) has a dynamic control that does [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://elegantcode.com/wp-content/uploads/2009/09/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://elegantcode.com/wp-content/uploads/2009/09/image_thumb.png" width="497" height="102" /></a> </p>
<p><strong>Problem</strong>: You need text to dynamically add elipses, &quot;&#8230;&quot;,&#160; to the end of a sentence.&#160; The difficulty is how do you detect the actual length of the string.&#160; All characters are not created the same.&#160; Ten i’s != ten m’s.</p>
<p><strong>Solution</strong>: Robby Ingebretsen at <a href="http://nerdplusart.com/about/" target="_blank">NerdPlusArt.com</a> (and of <a href="http://www.kaxaml.com/" target="_blank">Kaxaml</a> fame) has a dynamic control that does just this.&#160; <a href="http://blog.nerdplusart.com/archives/texttrimming-textblock-for-silverlight">http://blog.nerdplusart.com/archives/texttrimming-textblock-for-silverlight</a>.</p>
<p>The solution is very Elegant.&#160; Robby wraps a TextBlock in a Content control then manipulates the Text inside based on the size.&#160; Best of all…he as post <a href="http://labs.nerdplusart.com/dynamictextblock/DynamicTextBlock.cs" target="_blank">code</a> and an <a href="http://labs.nerdplusart.com/dynamictextblock/" target="_blank">example</a>.&#160; Thanks Robby.</p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/09/14/silverlight-tip-dynamic-textblock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ToggleButton Command for Prism</title>
		<link>http://elegantcode.com/2009/06/24/togglebutton-command-for-prism/</link>
		<comments>http://elegantcode.com/2009/06/24/togglebutton-command-for-prism/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 23:30:56 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[Esoterica]]></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://elegantcode.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://elegantcode.com/wp-content/uploads/2009/06/image-thumb1.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://elegantcode.com/wp-content/uploads/2009/06/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://elegantcode.com/wp-content/uploads/2009/06/image-thumb2.png" width="240" height="143" /></a></p>
<p align="center">UnChecked.cs    <br />&#160;<a href="http://elegantcode.com/wp-content/uploads/2009/06/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://elegantcode.com/wp-content/uploads/2009/06/image-thumb3.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://elegantcode.com/wp-content/uploads/2009/06/image3.png"><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://elegantcode.com/wp-content/uploads/2009/06/image-thumb4.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://elegantcode.com/wp-content/uploads/2009/06/image4.png"><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://elegantcode.com/wp-content/uploads/2009/06/image-thumb5.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://elegantcode.com/wp-content/uploads/2009/06/image5.png"><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://elegantcode.com/wp-content/uploads/2009/06/image-thumb6.png" width="600" height="1043" /></a> </p>
<h3>The final product   <br /></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-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://elegantcode.com/wp-content/uploads/2009/06/image6.png" width="570" height="423" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/06/24/togglebutton-command-for-prism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 essentials to quickly learning Blend</title>
		<link>http://elegantcode.com/2009/05/20/3-essentials-to-quickly-leaning-blend/</link>
		<comments>http://elegantcode.com/2009/05/20/3-essentials-to-quickly-leaning-blend/#comments</comments>
		<pubDate>Thu, 21 May 2009 04:12:39 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[Esoterica]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/05/20/3-essentials-to-quickly-leaning-blend/</guid>
		<description><![CDATA[The past few weeks I&#8217;ve been working with a great team at IQ Interactive.&#160; Everyone is open and eager to learn Expression Blend and Silverlight, and I so badly want to teach/show them.&#160; More often than not though, time is not a friend which makes it critical to identify what people need and want to [...]]]></description>
			<content:encoded><![CDATA[<p>The past few weeks I&#8217;ve been working with a great team at IQ Interactive.&#160; Everyone is open and eager to learn Expression Blend and Silverlight, and I so badly want to teach/show them.&#160; More often than not though, time is not a friend which makes it critical to identify what people need and want to see.</p>
<p>To paint the picture, I am introducing Silverlight to creatives, Flash devs, and people in the business.&#160; Each group needs a different story.&#160; At first I went about it the same way: naturally I would load Visual Studio, create a new project, knock out some XAML, and then run the app.&#160; THIS IS NOT A GOOD IDEA.&#160; Instead, I found myself increasingly opening Blend and showing people around.&#160; This lead to more interest and more questions.</p>
<p>Side note: Visual Studio is an amazing development tool, however I strongly believe Blend will become the tool of choice for developing Silverlight applications.&#160; I don&#8217;t see this happening in for Blend 3 or 4, but Blend is making a compelling case to be THE tool for Silverlight dev.</p>
<p>All this background leads me to this conclusion: If you want to quickly pick up Silverlight, start with Blend (there is a 30-day free trial).&#160; Additionally, here are the first 3 topics you should focus on once in Blend:</p>
<ol>
<li>Understanding the Layout Panels </li>
<li>Animations </li>
<li>States and Templating </li>
</ol>
<p>(I realize this is a simplification.&#160; Topics like databinding, integrating sample data, and wiring up events are important.&#160; However, these three topics are a perfect starting point.)</p>
<h3>Understanding the Layout Panels</h3>
<p>There are three main Layout panels in Silverlight 3: the Grid, Canvas, and StackPanel.&#160; The Silverlight Toolkit offers more layout types such as DockPanel, WrapPanel, and ViewBox.&#160; Here’s a brief look at the three main panels:</p>
<p><strong>Canvas</strong> – the most basic panel.&#160; Elements are placed at explicit coordinates.</p>
<p><strong>Grid</strong> – the most flexible of the three.&#160; Elements can be arranged in rows and columns.&#160; Additionally children can grow dynamically within the Grid.</p>
<p><strong>StackPanel</strong> – arrangement of children elements are handled automatically.&#160; The StackPanel is a great option when you have a list of items.</p>
<p>For a more in depth look at the Layout Panels check out Scott Guthries <a href="http://weblogs.asp.net/scottgu/pages/silverlight-tutorial-part-2-using-layout-management.aspx" target="_blank">post</a>.</p>
<h4>Layout Panels in Blend</h4>
<p>Once you know and get comfortable with how each panel works, you’ll be able to make the best decision for your application.&#160; The tendency for Flash developers might be to go straight to the Canvas, then handle updating the layout from code.&#160; I urge you to take some time to play around with the other panels</p>
<p>In Blend, you can draw panels on the Artboard by selecting a panel from the Toolbox.&#160; </p>
<p>&#160;<a href="http://elegantcode.com/wp-content/uploads/2009/05/1349412662d845907f6e.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1349-412662d845907f6e" border="0" alt="1349-412662d845907f6e" src="http://elegantcode.com/wp-content/uploads/2009/05/1349412662d845907f6e-thumb.png" width="193" height="160" /></a></p>
<h3>Animations</h3>
<p>Getting comfortable with animating elements in Blend takes a little getting use to.&#160; The first time you try to add an animation it takes a minute to locate the add animation button.&#160; It’s the plus sign at the top of the Objects and Timeline panel:</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/05/image6.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://elegantcode.com/wp-content/uploads/2009/05/image-thumb5.png" width="308" height="197" /></a> </p>
<p>After you’ve created the Storyboard, the Artboard gets a red outline.&#160; This lets you know you are recording.&#160; Any property changed while recording will be added to the animation.&#160; It took me some time getting use to this.</p>
<p>A tip to working with animations is to change Workspace to an Animation friendly view.&#160; Do this by selecting Window &gt; Workspaces &gt; Animation.&#160; You’ll notice, the Timeline stretches out at the bottom.</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/05/image7.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://elegantcode.com/wp-content/uploads/2009/05/image-thumb6.png" width="404" height="231" /></a> </p>
<h3>States &amp; Templating</h3>
<p>Finally, in my opinion, the most important thing to understand Sttes and Templating.&#160; The reason I think it’s so important is because of Silverlight’s rich control set.&#160; Understanding Templating and States enables you to use existing controls and completely change the visuals while still maintaining it’s base States and functionality.</p>
<p>This topic is very deep and much better served in it’s own post.&#160; For the time being here are a couple links about States and Templating.</p>
<p>What are States &#8211; <a href="http://kokchiann.wordpress.com/2008/06/05/visual-state-manager-new-feature-of-expression-blend/">http://kokchiann.wordpress.com/2008/06/05/visual-state-manager-new-feature-of-expression-blend/</a></p>
<p>Templating a ToggleButton to look like a playhead for a video player &#8211; <a href="http://www.85turns.com/2008/09/05/making-a-play-pause-button-in-silverlight/">http://www.85turns.com/2008/09/05/making-a-play-pause-button-in-silverlight/</a></p>
</p>
<p> <font color="#333333"></font></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/05/20/3-essentials-to-quickly-leaning-blend/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Visual Studio Tip: Open XAML in code only mode</title>
		<link>http://elegantcode.com/2009/04/23/visual-studio-tip-open-xaml-in-code-only-mode/</link>
		<comments>http://elegantcode.com/2009/04/23/visual-studio-tip-open-xaml-in-code-only-mode/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 15:13:03 +0000</pubDate>
		<dc:creator>cschuman</dc:creator>
				<category><![CDATA[Esoterica]]></category>

		<guid isPermaLink="false">http://elegantcode.com/2009/04/23/visual-studio-tip-open-xaml-in-code-only-mode/</guid>
		<description><![CDATA[A major annoyance of mine after installing a new instance of Visual Studio is when I open a XAML document for the first time. By default, Visual Studio opens a XAML document in Preview mode (the design on the top and the code view on the bottom).&#160; As you start adding more and more elements [...]]]></description>
			<content:encoded><![CDATA[<p>A major annoyance of mine after installing a new instance of Visual Studio is when I open a XAML document for the first time. By default, Visual Studio opens a XAML document in Preview mode (the design on the top and the code view on the bottom).&#160; As you start adding more and more elements to XAML, Visual Studio will render the XAML in the design view, even going as far as playing video back if you have a MediaElement defined.</p>
<p>The option to turn this off is buried in the Options.&#160; The below figures show how to change the default behavior.</p>
<p>First click <strong>Tools &gt; Options</strong>.</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/04/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://elegantcode.com/wp-content/uploads/2009/04/image-thumb2.png" width="295" height="175" /></a> </p>
<p>Then navigate to <strong>Text Editor &gt; XAML &gt; Miscellaneous</strong>.&#160; Check the box that says <strong>Always open document in full XAML view</strong>.&#160; If you don’t see <strong>Text Editor </strong>in the options menu, check the box <strong>Show all settings </strong>in the bottom left of the Options window.</p>
<p><a href="http://elegantcode.com/wp-content/uploads/2009/04/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://elegantcode.com/wp-content/uploads/2009/04/image-thumb3.png" width="604" height="349" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://elegantcode.com/2009/04/23/visual-studio-tip-open-xaml-in-code-only-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
