<?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"
	>

<channel>
	<title>Microsoft.Net &#124; Silverlight &#124; ASP.Net</title>
	<atom:link href="http://joel.neubeck.net/feed" rel="self" type="application/rss+xml" />
	<link>http://joel.neubeck.net</link>
	<description>Simplifing structure without changing results</description>
	<pubDate>Wed, 19 Nov 2008 17:58:29 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
	<language>en</language>
			<item>
		<title>Developing a Casual Games with Silverlight 2 - Module 2</title>
		<link>http://joel.neubeck.net/2008/11/casual-game-m2-expression-newsletter/</link>
		<comments>http://joel.neubeck.net/2008/11/casual-game-m2-expression-newsletter/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 17:54:59 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[AABB]]></category>

		<category><![CDATA[casual games]]></category>

		<category><![CDATA[Collision]]></category>

		<category><![CDATA[Expression Newsletter]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=319</guid>
		<description><![CDATA[This week Microsoft published the latest issue of the Expression Newsletter.  If you have not seen the newsletter its a great series of articles focused on using Silverlight and the Expression tools to create amazing rich interactive solutions.  In this latest issue I was asked to contribute the second of a six part [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.microsoft.com/expression/news-press/newsletter/default.aspx"><img class="alignnone size-full wp-image-236" title="Microsoft Expression" src="http://joel.neubeck.net/wp-content/uploads/2008/09/microsoft_expression_logo.gif" alt="" width="191" height="62" /></a>This week Microsoft published the latest issue of the Expression Newsletter.  If you have not seen the newsletter its a great series of articles focused on using Silverlight and the Expression tools to create amazing rich interactive solutions.  In this latest issue I was asked to contribute the second of a six part series of articles on  <a href="http://expression.microsoft.com/en-us/dd279542.aspx">exploring the process of designing and building a casual online game in Silverlight 2.</a>.   Here is what  the series will include.</p>
<ul>
<li>Module 1: Getting Started – Architecture / framework</li>
<li><strong>Module 2: Movement and collision detection</strong></li>
<li>Module 3: Design – Sprites, boards and dialogs</li>
<li>Module 4: Animations and sound</li>
<li>Module 5: Initialization and Deployment</li>
<li>Module 6: Advanced concepts (Physics, Multiplayer, Optimization)</li>
</ul>
<p>Make sure to check out the article at <a href="http://www.microsoft.com/expression/news-press/newsletter/">http://www.microsoft.com/expression/news-press/newsletter/</a></p>
<p><code> </code></p>
<p>Code: COMING SOON</p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/11/casual-game-m2-expression-newsletter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>iLinc &#8220;Ask the Expert&#8221; Webinar Series</title>
		<link>http://joel.neubeck.net/2008/11/ilinc-mcandre/</link>
		<comments>http://joel.neubeck.net/2008/11/ilinc-mcandre/#comments</comments>
		<pubDate>Sat, 15 Nov 2008 16:45:51 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Industry]]></category>

		<category><![CDATA[Terralever]]></category>

		<category><![CDATA[iLinc]]></category>

		<category><![CDATA[Scott McAndrew]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=310</guid>
		<description><![CDATA[
Marketing Playbook:  7 Online Marketing Strategies to Build a Competitive Advantage

Presenter: Scott McAndrew, Director of Strategy, Terralever
When: Tuesday, November 18, 2008, 2:00pm Eastern (11:00am Pacific)
Duration:  60 minutes
Includes Live Q&#38;A
As the world of marketing continuously changes, organizations of all sizes must take a critical eye on where their prospects and customers get information about the industry, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="https://mktgevents.ilinc.com/perl/ilinc/lms/register.pl?activity_id=hmchfv&#038;pp=ilincevents12"><br />
<h1>Marketing Playbook:  7 Online Marketing Strategies to Build a Competitive Advantage</h1>
<p></a><br />
<strong>Presenter</strong>: <a href="http://www.onlinemarketingperformance.com/">Scott McAndrew</a>, Director of Strategy, Terralever<br />
<strong>When</strong>: Tuesday, November 18, 2008, 2:00pm Eastern (11:00am Pacific)<br />
<strong>Duration</strong>:  60 minutes<br />
Includes Live Q&amp;A</p>
<p>As the world of marketing continuously changes, organizations of all sizes must take a critical eye on where their prospects and customers get information about the industry, your brand and how they make buying decisions on the web.</p>
<p>Customers and prospects want to be reached with new marketing tools that involve the use of social networking sites and Web 2.0 technologies. Bottom line: businesses that have online marketing strategies have an edge over the competition.</p>
<p>Join Scott McAndrew, a strategic marketing guru with Terralever, an interactive marketing agency who&#8217;s clients include Red Bull, NBA, Facebook and Microsoft. In this webinar, Scott will help lay out your Marketing Playbook with the 7 Online Marketing Methods that will give you competitive advantage and change the way customers find you online.</p>
<p>During the webinar you will learn:</p>
<ul>
<li>Key challenges facing marketers today&#8211;and how to navigate the many options out there for you</li>
<li>Tools you can start leveraging today in Social Media and Social Networks to build a community of brand advocates</li>
<li>Demystifying vertical search. What is it? And how B2B, B2C and niche marketers are seeing benefits</li>
<li>What&#8217;s possible&#8211;what is the benchmark</li>
<li>How to measure, test and mature your online marketing program</li>
<li>And much more</li>
</ul>
<p><br style="clear:both"/></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/11/ilinc-mcandre/feed/</wfw:commentRss>
		</item>
		<item>
		<title>RatingControl with Theme support</title>
		<link>http://joel.neubeck.net/2008/11/ratingcontrol-theme/</link>
		<comments>http://joel.neubeck.net/2008/11/ratingcontrol-theme/#comments</comments>
		<pubDate>Sun, 09 Nov 2008 06:37:18 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[ControlTemplate]]></category>

		<category><![CDATA[ImplicitStyleManager]]></category>

		<category><![CDATA[Rating Control]]></category>

		<category><![CDATA[Theming]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=302</guid>
		<description><![CDATA[This past Wednesday I was asked to present at the Phoenix Silverlight users group on the topic of writing custom controls.  Back a few months ago I created a very simple version of a Silverlight Rating control and thought it would be a great example to demonstrate how to leverage Control Templates, Visual State [...]]]></description>
			<content:encoded><![CDATA[<p>This past Wednesday I was asked to present at the Phoenix Silverlight users group on the topic of writing custom controls.  Back a few months ago I created a very simple version of a Silverlight Rating control and thought it would be a great example to demonstrate how to leverage Control Templates, Visual State manager and styling.  Back when I created the control I choose to use &#8220;/themes/generic.xaml&#8221; as a way to provide the default styling of my control.  This works great if a developer wants to tweek the layout of the control before using it in there project, but was never intended to skin the control at runtime.</p>
<p>A few weeks back around PDC, Microsoft released the <a href="http://www.codeplex.com/Silverlight">Silverlight Toolkit</a> a collection of Silverlight controls developers and designers can use in there Silverlight projects.  What is really cool about the way in which Shawn Burke&#8217;s team is working on control development, is this idea of releasing controls on Codeplex to get them quickly into the community.</p>
<p>If you play around with the toolkit you will quickly stumble on a new assembly called: &#8220;Microsoft.Windows.Controls.Theming&#8221;.  In a nut shell what this class does is give control developers access to the ability to theme their controls.  One of the key elements of this assembly is the &#8220;ImplicitStyleManager&#8221;.  This class exposes some attached properties that allow designers to specify an external resource file (.xaml) containing styles which can be applied to a control and each of the controls children.</p>
<p>Here is what i did to get my RatingControl to use the implicit style manager.  First I added a reference in my page.xaml to the Theming namespace.</p>

<div class="wp_syntax"><div class="code"><pre class="c-sharp" style="font-family:monospace;">xmlns:theming=&quot;clr-namespace:
Microsoft.Windows.Controls.Theming;
assembly=Microsoft.Windows.Controls.Theming&quot;</pre></div></div>

<p>Next I inserted a a few attributes into my rating control declaration to specify the location of my theme and how I wanted my theme applied.  I choose &#8220;Auto&#8221; which applies the theme immediately when the control is loaded.<br />
<a href="http://joel.neubeck.net/wp-content/uploads/2008/11/implicitstyle.png"><img class="alignleft size-full wp-image-303" title="implicitstyle" src="http://joel.neubeck.net/wp-content/uploads/2008/11/implicitstyle.png" alt="" width="500" height="89" /></a><br style="clear:both"/><br />
Lastly I copied my generic.xaml file into a new themes directory located in my test Silverlight project and renamed it to &#8220;themeA.xaml&#8221;.  Just to prove that the theme was loading I changed my RatingButton style to display an ellipse instead of the default star&#8217;s I had used in my original example.  Below is how it all turned out.</p>
<p><iframe src="/wp-content/uploads/2008/11/Rating/default.html" frameborder="0" width="300" height="300"></iframe>  </p>
<p>Code: <a onclick="javascript: pageTracker._trackPageview('/code/Rating2.zip');" href="/wp-content/uploads/2008/11/Rating/Rating.zip">Rating.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/11/ratingcontrol-theme/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Terralever&#8217;s Zero Gravity Updated</title>
		<link>http://joel.neubeck.net/2008/10/zero-gravity-updated/</link>
		<comments>http://joel.neubeck.net/2008/10/zero-gravity-updated/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 18:48:00 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Terralever]]></category>

		<category><![CDATA[game]]></category>

		<category><![CDATA[Zero Gravity]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=288</guid>
		<description><![CDATA[This morning Terralever updated its first Silverlight 2 game, Zero Gravity.  If you have never had a chance to play the game, make sure to go check it out.  I think the game is a blast, not to mention a bit addictive.
]]></description>
			<content:encoded><![CDATA[<p><a href="http://ltbennett.com"><img class="alignleft size-full wp-image-289" title="zerogravit" src="http://joel.neubeck.net/wp-content/uploads/2008/10/zerogravit.jpg" alt="" width="251" height="202" /></a>This morning Terralever updated its first Silverlight 2 game, Zero Gravity.  If you have never had a chance to play the game, make sure to go check it out.  I think the game is a blast, not to mention a bit addictive.<br style="clear:both" /></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/10/zero-gravity-updated/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight 2 goes live Tuesday</title>
		<link>http://joel.neubeck.net/2008/10/silverlight-2-goes-live-tuesday/</link>
		<comments>http://joel.neubeck.net/2008/10/silverlight-2-goes-live-tuesday/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 18:39:06 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[RTW]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=283</guid>
		<description><![CDATA[Microsoft made it official, Silverlight 2 will be available for download on Tuesday, Oct. 14, at http://www.microsoft.com/silverlight. This has been a long time in the coming and I am extremely excited for what this means for Silverlight and the future of the framework.  Over the last few days I have update the majority of [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://joel.neubeck.net/wp-content/uploads/2008/06/silverlight.png"><img class="alignleft size-medium wp-image-150" title="silverlight" src="http://joel.neubeck.net/wp-content/uploads/2008/06/silverlight-270x300.png" alt="" width="132" height="148" /></a>Microsoft made it official, Silverlight 2 will be available for download on Tuesday, Oct. 14, at <a href="http://www.microsoft.com/silverlight" target="_blank">http://www.microsoft.com/silverlight</a>. This has been a long time in the coming and I am extremely excited for what this means for Silverlight and the future of the framework.  Over the last few days I have update the majority of my samples so expect them all to be posted once  the download is made avaialble to the public.</p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/10/silverlight-2-goes-live-tuesday/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ready set update! - Silverlight 2 RTM is just days away.</title>
		<link>http://joel.neubeck.net/2008/10/ready-set-update-silverlight-2-rtm-is-just-days-away/</link>
		<comments>http://joel.neubeck.net/2008/10/ready-set-update-silverlight-2-rtm-is-just-days-away/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 18:34:34 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[RC0]]></category>

		<category><![CDATA[RTM]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=277</guid>
		<description><![CDATA[This morning Microsoft released the following press release which suggests that Silverlight RTM may only be days away.   If you have not done so,  make sure to download the Breaking changes doc and RC0 build to start testing how your Beta 2 code will behave with the RTM release.  Next week [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.microsoft.com/presspass/press/2008/oct08/10-10GuthrieSilverlightMA.mspx?rss_fdn=Press%20Releases"><img class="alignleft size-medium wp-image-150" title="silverlight" src="http://joel.neubeck.net/wp-content/uploads/2008/06/silverlight-270x300.png" alt="" width="124" height="138" /></a>This morning Microsoft released the following press release which suggests that Silverlight RTM may only be days away.   If you have not done so,  make sure to download the Breaking changes doc and RC0 build to start testing how your Beta 2 code will behave with the RTM release.  Next week could be a very exciting week!<br />
Here is what the press release had to say:<br style="clear:both"/></p>
<blockquote><p>Microsoft Corp. will hold a teleconference with Scott Guthrie, corporate vice president of the .NET Developer Division at Microsoft. Guthrie will make a significant announcement related to Microsoft Silverlight. A recording of the call and additional information will be available for 30 days on the Microsoft Silverlight PressPass Web site: <a href="http://www.microsoft.com/presspass/presskits/silverlight/default.mspx">http://www.microsoft.com/presspass/presskits/silverlight/default.mspx</a>.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/10/ready-set-update-silverlight-2-rtm-is-just-days-away/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Developing a Casual Games with Silverlight 2 - Module 1</title>
		<link>http://joel.neubeck.net/2008/09/casual-game-m1-expression-newsletter/</link>
		<comments>http://joel.neubeck.net/2008/09/casual-game-m1-expression-newsletter/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 14:00:50 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Industry]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[Blend]]></category>

		<category><![CDATA[casual games]]></category>

		<category><![CDATA[Expression]]></category>

		<category><![CDATA[Expression Newsletter]]></category>

		<category><![CDATA[MVC]]></category>

		<category><![CDATA[Tutorial]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=233</guid>
		<description><![CDATA[This week Microsoft published the latest issue of the Expression Newsletter.  If you have not seen the newsletter its a great series of articles focused on using Silverlight and the Expression tools to create amazing rich interactive solutions.  In this latest issue I was asked to contribute the first of a six part [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.microsoft.com/expression/news-press/newsletter/default.aspx"><img class="alignnone size-full wp-image-236" title="Microsoft Expression" src="http://joel.neubeck.net/wp-content/uploads/2008/09/microsoft_expression_logo.gif" alt="" width="191" height="62" /></a>This week Microsoft published the latest issue of the Expression Newsletter.  If you have not seen the newsletter its a great series of articles focused on using Silverlight and the Expression tools to create amazing rich interactive solutions.  In this latest issue I was asked to contribute the first of a six part series of articles on  <a href="http://expression.microsoft.com/en-us/cc964002.aspx">exploring the process of designing and building a casual online game in Silverlight 2.</a>.   Here is what  the series will include.</p>
<ul>
<li>Module 1: Getting Started – Architecture / framework</li>
<li>Module 2: Movement and collision detection</li>
<li>Module 3: Design – Sprites, boards and dialogs</li>
<li>Module 4: Animations and sound</li>
<li>Module 5: Initialization and Deployment</li>
<li>Module 6: Advanced concepts (Physics, Multiplayer, Optimization)</li>
</ul>
<p>Make sure to check out the article at <a href="http://www.microsoft.com/expression/news-press/newsletter/">http://www.microsoft.com/expression/news-press/newsletter/</a> </p>
<p><code>
<p>Code: <a onclick="javascript: pageTracker._trackPageview('/code/ENM1/Game.zip');" href="/wp-content/uploads/2008/09/ENM1/Game.zip">Game.zip</a></p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/09/casual-game-m1-expression-newsletter/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Transformation Matrix in Silverlight 2</title>
		<link>http://joel.neubeck.net/2008/09/transformation-matrix-in-silverlight-2/</link>
		<comments>http://joel.neubeck.net/2008/09/transformation-matrix-in-silverlight-2/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 05:53:58 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[code]]></category>

		<category><![CDATA[matrix]]></category>

		<category><![CDATA[MatrixTransform]]></category>

		<category><![CDATA[RenderTransform]]></category>

		<category><![CDATA[Rotate]]></category>

		<category><![CDATA[Scale]]></category>

		<category><![CDATA[Skew]]></category>

		<category><![CDATA[Translate]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2008/09/transformation-matrix-in-silverlight-2/</guid>
		<description><![CDATA[In my exploration of Silverlight I have looked at a ton of code samples, and not once have I seen an example that chooses MatrixTransform as the class used to render a transformation.&#160; We all should be familiar with the four transform classes Silverlight provides for 2-D transformations.&#160; Each allows us to manipulate the underlying [...]]]></description>
			<content:encoded><![CDATA[<p>In my exploration of Silverlight I have looked at a ton of code samples, and not once have I seen an example that chooses MatrixTransform as the class used to render a transformation.&#160; We all should be familiar with the four transform classes Silverlight provides for 2-D transformations.&#160; Each allows us to manipulate the underlying matrix without having to understand how the matrix is structured.&#160; All of them can be grouped into a single TransformGroup to apply multiple transformations to a single object.</p>
<ul>
<li>TransformGroup
<ul>
<li>RotateTransform – Rotates by an angle </li>
<li>ScaleTransform – Scales by a a given X and Y </li>
<li>SkewTransform – Skews an element by an X and Y angle </li>
<li>TranslateTransform – Moves and object by a specified X and Y </li>
</ul>
</li>
</ul>
<p dir="ltr">As an alternative, you can use the MatrixTransform as a way to manipulate a matrix directly.</p>
<h2>What is a Matrix</h2>
<p>In Silverlight a matrix is a 3&#215;3 array of numbers used to define <strong>affine</strong> transformations.&#160; Here is a great definition of a Affine transformation taken from an excellent tutorial on using matrices in Flash.</p>
<p> <a href="http://www.senocular.com/flash/tutorials/transformmatrix/" target="blank"><br />
<blockquote>
<p>Affine transformations are transformations that preserve collinearity and relative distancing in a transformed coordinate space. This means points on a line will remain in a line after an affine transformation is applied to the coordinate space in which that line exists.</p>
</blockquote>
<p> </a>
<p>Silverlight uses row-major matrices, such that vectors are expressed as rows and not column vectors.&#160; Here is what the matrix structure looks like.</p>
<table cellspacing="0" cellpadding="2" width="230" border="1">
<tbody>
<tr>
<td valign="top" width="91">M11 (1.0)</td>
<td valign="top" width="99">M12 (0.0)</td>
<td valign="top" width="38">0</td>
</tr>
<tr>
<td valign="top" width="91">M21 (0.0)</td>
<td valign="top" width="99">M22 (1.0)</td>
<td valign="top" width="38">0</td>
</tr>
<tr>
<td valign="top" width="91">Offset X (0.0)</td>
<td valign="top" width="99">Offset Y (0.0)</td>
<td valign="top" width="38">1</td>
</tr>
</tbody>
</table>
<p>Since Silverlight only supports affine transforms, the values in the right column are always 0,0,1.&#160; Below is an example of a Silverlight UserControl that demonstrates how manipulating each of the matrices values, will transform a rectangle.</p>
<p> <iframe src="/wp-content/uploads/2008/09/Matrix/" width="500" height="200"></iframe>
<p>In my demonstration, using the appropriate TextBox&#160; you can rotate, scale, skew, and move the rectangle. For example, if you set M12 equal to 0.5 and M21 equal to -0.5 you will rotate the rectangle 45 deg.&#160; If you set M11 and M22 equal to 1.5 you will scale the rectangle proportionately to approximately one and half times its original size. </p>
<p>Procedurally, these values can be set by defining a Matrix struct and setting the appropriate property (M11, M12, M21, M22, OffsetX, OffsetY).&#160; The matrix can be applied to an objects RenderTransform by simply setting the MatrixTransform.Matrix property.</p>
</p>

<div class="wp_syntax"><div class="code"><pre class="c-sharp" style="font-family:monospace;">Matrix martix = new Matrix(1.5,0.5,-0.5,1.5,0,0);
MatrixTransform transform = new MatrixTransform();
transform.Matrix = matrix;
rectangle.RenderTransform = transform;</pre></div></div>

<p>Later in the week I will post an example that uses a MatrixTransform to demonstrate an animation that reacts to mouse movement.&#160; Nothing crazy, but a nice example of where a Matrix can create an interesting effect with very little code.</p>
<p>Code: <a onclick="javascript: pageTracker._trackPageview('/code/Matrix.zip');" href="/wp-content/uploads/2008/09/Matrix/MatrixExample.zip">MatrixExample.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/09/transformation-matrix-in-silverlight-2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Templated Silverlight Rating Control</title>
		<link>http://joel.neubeck.net/2008/09/templated-silverlight-rating-control/</link>
		<comments>http://joel.neubeck.net/2008/09/templated-silverlight-rating-control/#comments</comments>
		<pubDate>Wed, 10 Sep 2008 21:36:26 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[ContentControl]]></category>

		<category><![CDATA[ControlTemplate]]></category>

		<category><![CDATA[Rating Control]]></category>

		<category><![CDATA[Template Binding]]></category>

		<category><![CDATA[Visual State Manager]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/2008/09/templated-silverlight-rating-control/</guid>
		<description><![CDATA[Anyone that has been working with the standard set of controls for Silverlight 2 Beta 2 has been exposed to the concept of template binding and how VisualStateManager (VSM) controls state.&#160;&#160; In this example I will build a templated control&#160; to learn how to use VSM, template binding and the ContentControl base class.&#160; 
The control [...]]]></description>
			<content:encoded><![CDATA[<p>Anyone that has been working with the standard set of controls for Silverlight 2 Beta 2 has been exposed to the concept of template binding and how VisualStateManager (VSM) controls state.&#160;&#160; In this example I will build a templated control&#160; to learn how to use VSM, template binding and the ContentControl base class.&#160; </p>
<p>The control I choose to create is a Rating control .&#160; The goal is to display a series of Stars that both visualize an overall average score, and allows a user to submit their own rating.&#160; Here is what the control looks like.</p>
<p> <iframe src="/wp-content/uploads/2008/09/Rating/default.html" frameborder="0" width="300" height="200"></iframe>  <br /> <br />
<h2>RatingControl</h2>
<p>The control is comprised of two components: RatingControl and RatingButton. The RatingControl is derived from ContentControl and can either be given an explicit set of RatingButtons, or can automatically create them based on a user setting. Here are the properties I have chosen to expose in RatingContorl:</p>
<ul>
<li>Max (Int): The number of RatingButtons to display </li>
<li>Total (double): The number of votes that have been cast </li>
<li>Score (double): The average rating across all&#160; submissions </li>
<li>UseIndicators(bool): Determines if we will display indicators for what each star represents. </li>
</ul>
<p>There are two ways in which you can populate the rating control.&#160; The first is to set the Max property and allow the control to add the appropriate number of children.&#160; This works great if you don’t need to specify an individual Indicator (ToolTip) for each RatingButton.&#160; The second approach is to explicitly add RatingButtons to the content property of the RatingControl.&#160; Here is what that would look like in Xaml.</p>
<p> <a href="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-1.png"><img title="rating_1" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="143" alt="rating_1" src="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-1-thumb.png" width="450" align="left" border="0" /></a>   <br style="clear: both" />
<p>By choosing to have our RatingControl inherent from ContentControl it takes care of giving us the ability to set the children of our Content property.&#160; In this example I am assuming a FrameworkElement derived from Panel (Grid or StackPanel) is placed inside of Content.&#160; This makes it very easy to iterate through the panels children and identify each RatingButton.&#160; The following shows the code I used to make the decisions if I would create my own RatingButtons, or use those specified in the RatingControl.Content element.</p>
<p><a href="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-2.png"><img title="rating_2" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="335" alt="rating_2" src="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-2-thumb.png" width="450" align="left" border="0" /></a> </p>
<p>  <br style="clear: both" />
<p>Since I was allowing this control to be templated, I choose to do this setup in the controls Loaded event handler.&#160; This allows me to set the controls Content property equal to my manually created StackPanel, prior to the controls ApplyTemplate method being executed.&#160; This ensures that any special formatting around the panel is applied after the RatingButtons have been added.</p>
<h2>RatingButton</h2>
<p>To minimize the amount of code I needed to write for this control I decided to build my RatingButton control on top of the System.Windows.Controls.Primitives.ToggleButton.&#160; If you are not familiar with this control it is a very flexible Button that supports three states (Checked, Uncheked, Null).&#160; This is perfect for my example where I will need my star to be visualizes as either filled, empty or half filled star. </p>
<p>For all extensive purposes I left the ToggleButton alone and only overrode OnToggle, OnMouseEnter and OnMouseDown.&#160; Here is what that code looks like.</p>
<p><a href="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-3.png"><img title="rating_3" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="364" alt="rating_3" src="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-3-thumb.png" width="450" align="left" border="0" /></a> </p>
<p>  <br style="clear: both" />
<p>Since each RatingButton needs to behave as a group, I had to circumvent how the ToggleButton would change visual state, and allow RatingControl to manage this process.&#160; The first method UpdateChecked, simply iterates over each rating button, and based on the Score, determines which ones would be checked.&#160; For my visualization I decide that an average score &gt; N.3, but &lt; N.7 would visualize a half star, where as anything above or below would visualize a full or empty star.&#160; I allow the IsChecked property of ToggleButton to switch to the appropriate visual state (Checked, UnChecked or Intermediate).</p>
<p>In the event that a user is hovering over the rating control, I want to visualize a different color of filled star.&#160; Once again I need to allow the RatingControl to determine which RatingButtons need to react to the hover.&#160; The following demonstrates how I achieved this effect. </p>
<p><a href="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-4.png"><img title="rating_4" style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="317" alt="rating_4" src="http://joel.neubeck.net/wp-content/uploads/2008/09/rating-4-thumb.png" width="450" align="left" border="0" /></a> </p>
<p>  <br style="clear: both" />
<p>Since once again we choose to circumvent how the ToggleButton switches state on hover, we must&#160; use VisualStateManger.GotToState to trigger the appropriate state of the RatingButton we are evaluating (MouseOver or Normal).&#160;&#160; </p>
<p>To&#160; customize the visualization of the this control you can either edit my default style in Blend 2.5, or you can clone it and make your own changes. The Control template is as simple as I could make it to allow users full control over how the RatingButton icons look, and how the states are visualized.&#160; </p>
<p>Code: <a onclick="javascript: pageTracker._trackPageview('/code/Rating.zip');" href="/wp-content/uploads/2008/09/Rating/Rating.zip">Rating.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/09/templated-silverlight-rating-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>PodCamp AZ 2008</title>
		<link>http://joel.neubeck.net/2008/09/podcamp-az-2008/</link>
		<comments>http://joel.neubeck.net/2008/09/podcamp-az-2008/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:54:52 +0000</pubDate>
		<dc:creator>joel</dc:creator>
		
		<category><![CDATA[Industry]]></category>

		<category><![CDATA[Conference]]></category>

		<category><![CDATA[Podcast]]></category>

		<category><![CDATA[social networking]]></category>

		<guid isPermaLink="false">http://joel.neubeck.net/?p=250</guid>
		<description><![CDATA[November 1-2, 2008 there is an interesting conference taking place at University of Advancing Technology (UAT) in Tempe, AZ.  This conference is described as a FREE BarCamp-style community conference.  The audience is podcasters and listeners, bloggers and readers, and anyone interested in New Media. here is a list of some of the presentations you could [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://podcampaz.org/" target="_blank"><img class="alignleft size-full wp-image-252" title="podcampaz" src="http://joel.neubeck.net/wp-content/uploads/2008/09/podcampaz.jpg" alt="" width="382" height="84" /></a>November 1-2, 2008 there is an interesting conference taking place at University of Advancing Technology (UAT) in Tempe, AZ.  This conference is described as a FREE BarCamp-style community conference.  The audience is podcasters and listeners, bloggers and readers, and anyone interested in New Media. here is a list of some of the presentations you could attend.</p>
<ul>
<li>How I Use Social Media to Make Real Money</li>
<li>New Media Interchange Meetup</li>
<li>Using Web 2.0 Tools in Education</li>
<li>Improving Your Online Video</li>
<li>How to strike a balance between sharing information freely and making a living using New Media</li>
<li>The Strange and Wonderful Adventure of NewsGangLive Social Media…  The Impact On You And Your Business</li>
<li>5 Reasons Your Podcast Sucks</li>
<li>Building a podcast from the ground up</li>
<li>Bottoms Up Leadership- Why are the most effective organizations leaderless?</li>
<li>Developing Community Around Your Podcast</li>
<li>Video on the Net: what should you be sending through the pipes?</li>
<li>Getting Big Media Coverage Using Social Media</li>
<li>Video on the Net: what should you be sending through the pipes?</li>
<li>Exergaming: Health Outside the XBox</li>
<li>So you want to make money with your podcast? Now what?</li>
<li>Podtaint: Fame in the New Media World</li>
<li>Saving the World with Social Media</li>
<li>Intro to Lighting for Video</li>
<li>Resident Feminist: Alice in the Wonder of Web 2.0 Technologies</li>
<li>Is Video Conversation Going to Thrive or Fade Out?</li>
<li>What’s involved in going from blog to book?</li>
<li>Starting it up Quick- How to start a startup and not make the classic mistakes quickly.</li>
<li>More than podcasting: It’s a Many-to-Many Media World</li>
<li>Real World Example: How to record and edit a remote tape sync show</li>
<li>Left brain, Right brain, Cyber brain…How to get clear on your specialized topic for fun and profit!</li>
<li>Healing Arts &amp; New Media</li>
<li>Web Marketing from Overwhelm to Clarity - Building a Foundation to Monetize Your Web Business</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://joel.neubeck.net/2008/09/podcamp-az-2008/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
