<?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>davidpoll.com &#187; Silverlight 3 Beta</title>
	<atom:link href="http://www.davidpoll.com/tag/silverlight-3-beta/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.davidpoll.com</link>
	<description>Software development and other goofy geeky goodness.</description>
	<lastBuildDate>Sat, 18 Jun 2011 22:03:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Update: Displaying background activity in a Silverlight RIA application</title>
		<link>http://www.davidpoll.com/2009/06/11/update-displaying-background-activity-in-a-silverlight-ria-application/</link>
		<comments>http://www.davidpoll.com/2009/06/11/update-displaying-background-activity-in-a-silverlight-ria-application/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 19:59:10 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[.NET RIA Services]]></category>
		<category><![CDATA[Activity Control]]></category>
		<category><![CDATA[BusyIndicator]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Silverlight 3 Beta]]></category>
		<category><![CDATA[WCF RIA Services]]></category>

		<guid isPermaLink="false">http://www.davidpoll.com/?p=73</guid>
		<description><![CDATA[Well, it’s been a while since I first posted on this, but the feedback was incredible, and I got some great suggestions.&#160; As a result, I’ve updated the Activity control and (finally) have a running sample on the web!&#160; The fundamental idea of the control has remained the same, as well as the mechanisms by [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><p>Well, it’s been a while since I <a href="http://www.davidpoll.com/?p=4" target="_blank">first posted</a> on this, but the feedback was incredible, and I got some great suggestions.&#160; As a result, I’ve updated the Activity control and (finally) have a running sample on the web!&#160; The fundamental idea of the control has remained the same, as well as the mechanisms by which it can work.&#160; It’s still a prototype, but a very useful one at that!</p>
<p>To see the Activity control in action, take a look here: <a href="http://www.davidpoll.com/Samples/ActivityControlDemo/ActivitySampleTestPage.aspx" target="_blank">Activity Control Demo</a></p>
<p>The demo requires the Silverlight 3 beta to be installed on your machine, which can be found here: <a title="http://silverlight.net/getstarted/silverlight3/default.aspx" href="http://silverlight.net/getstarted/silverlight3/default.aspx">http://silverlight.net/getstarted/silverlight3/default.aspx</a></p>
<p>The demo application shows two examples of using the Activity control to display async/background activity (click the images for deep-links into the Silverlight application):</p>
<ul>
<li>With <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en" target="_blank">.NET RIA Services</a> and the DomainDataSource, the Activity control uses element-to-element binding to indicate to the user that data is being loaded or submitted.&#160; The demo page is running live on my server using the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en" target="_blank">Northwind sample database</a>.&#160; Those of you who think you can play some dirty tricks by overwriting the data on my server (yes, I provided insert/update/delete functionality) – any attempts to do so will be quickly foiled, since the server will accept the requests, but ignore them! <img src='http://www.davidpoll.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </li>
</ul>
<p><a href="http://www.davidpoll.com/Samples/ActivityControlDemo/ActivitySampleTestPage.aspx#/RiaServicesActivity" target="_blank"><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=".NET RIA Services with the Activity Control" border="0" alt=".NET RIA Services with the Activity Control" src="http://www.davidpoll.com/wp-content/uploads/2009/06/image.png" width="604" height="329" /></a></p>
<ul>
<li>Any background activity might warrant using the activity control.&#160; The second example I’ve provided uses the activity control while I use a simple statistical method of approximating PI (yes, very geeky).&#160; It takes millions of iterations to get a mediocre approximation of PI (I know, I’m not using an efficient method, but it does do a lot of work!).&#160; Here, I’ve augmented the Activity control to allow the work to be stopped/cancelled: </li>
</ul>
<p><a href="http://www.davidpoll.com/Samples/ActivityControlDemo/ActivitySampleTestPage.aspx#/HeavyAsyncWork" target="_blank"><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="Calculating PI with background activity" border="0" alt="Calculating PI with background activity" src="http://www.davidpoll.com/wp-content/uploads/2009/06/image1.png" width="604" height="329" /></a></p>
<p>&#160;</p>
<p>So by now I’m sure you’re asking: “What’s changed?”&#160; Well, let me tell you!</p>
<ul>
<li>Thanks to feedback from a variety of folks, I’ve removed the all-encompassing template that included the pop-up window.&#160; That’s now baked into the control template.&#160; If you’d like to change it, you can use the <a href="http://www.microsoft.com/expression/try-it/blendpreview.aspx">Blend 3 Preview</a> to re-template the control.&#160; In its place, I’ve added:
<ul>
<li>A style for the progress bar.&#160; If you’d like to hide it, use a style to collapse the progress bar. </li>
<li>A means for setting “ActiveContent”.&#160; The Activity control works sort of like a HeaderedContentControl.&#160; You now have ActiveContent and ActiveContentTemplate, which allow you to define in XAML what should appear above the progress bar.&#160; You can put any content you like here, and it’s how I added the cancel button in my PI calculation example.&#160; This is also great because it allows you to easily change the text from “Loading…” to whatever you prefer simply be setting the ActiveContent property to the string of your choice! </li>
</ul>
</li>
<li>The default template for the ActivityControl now sets IsHitTestVisible and IsEnabled to false on its content immediately when IsActive becomes true.&#160; In my old prototype, this only happened when the Activity UI became visible, which meant users could continue to interact with the content while it was busy – a potentially dangerous combination if the user’s interactions can be overriden by the asynchronous work (such as editing values in a DataGrid when the data is being reloaded).&#160; This was from a suggestion by Luke Tigaris in the comments on my last post.&#160; Let me know what you think! </li>
<li>You can now call ResetActivity() on the control to force it to honor the visibility of the control immediately rather than enforcing the display delay and minimum display time.&#160; This way, if a user cancels the background work, you can force the Activity UI to be hidden immediately. </li>
</ul>
<p>&#160;</p>
<p>Anyhoo, let me know what you think of the changes!&#160; I’ve gotten lots of great feedback on the control so far, and I’m sure folks will come up with more as time goes on.</p>
<ul>
<li>You can download the source for the control here: <a href="http://www.davidpoll.com/Download/ActivityControl6-11.zip">Activity Control Source</a> </li>
<li>You can also download the source for the demo here: <a href="http://www.davidpoll.com/Download/ActivityControlDemo.zip">Activity Control Demo</a> </li>
</ul>
<p>For both of these, you’ll need the <a href="http://silverlight.net/getstarted/silverlight3/default.aspx">Silverlight 3 Beta</a>.&#160; The Demo application is built using <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=76bb3a07-3846-4564-b0c3-27972bcaabce&amp;displaylang=en" target="_blank">.NET RIA Services</a>.</p>
<p>P.S.&#160; Big thanks again to <a href="http://blogs.msdn.com/corrinab/">Corrina</a> for providing the <a href="http://blogs.msdn.com/brada/archive/2009/03/31/silverlight-3-navigation-application-template-extra-themes-posted.aspx">beautiful theme</a> I used in my application.</p>
<p>P.P.S.&#160; Isn’t navigation and deep-linking in the Silverlight 3 Beta cool?&#160; That’s how I made those images link directly to the corresponding pages of my demo application.&#160; I may post more on this in the future.&#160; In the meantime, take a look at the code to see just how little it took to accomplish that! (hint: MainPage.xaml in the Silverlight Navigation Application project template that’s included with the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=11dc7151-dbd6-4e39-878f-5081863cbb5d&amp;displaylang=en">Silverlight 3 Beta Tools for Visual Studio</a> has pretty much everything that’s required)</p>
<p><strong><em>Update 9/14/2009 – </em></strong>I’ve made a small update to the Activity control to fix a performance issue.&#160; You can find it <a href="http://www.davidpoll.com/2009/09/14/update-2-displaying-background-activity-in-a-silverlight-ria-application/">here</a>.</p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/06/11/update-displaying-background-activity-in-a-silverlight-ria-application/feed/</wfw:commentRss>
		<slash:comments>40</slash:comments>
		</item>
		<item>
		<title>Playing around with Silverlight 3… a late Easter Egg hunt – Revealed!</title>
		<link>http://www.davidpoll.com/2009/05/19/playing-around-with-silverlight-3-a-late-easter-egg-hunt-revealed/</link>
		<comments>http://www.davidpoll.com/2009/05/19/playing-around-with-silverlight-3-a-late-easter-egg-hunt-revealed/#comments</comments>
		<pubDate>Tue, 19 May 2009 07:44:37 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Blend]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Konami Code]]></category>
		<category><![CDATA[Silverlight 3 Beta]]></category>

		<guid isPermaLink="false">http://www.davidpoll.com/?p=57</guid>
		<description><![CDATA[About a week and a half ago I issued a challenge to folks to figure out what the Silverlight 3 application below does.&#160; I dropped a few hints, but nobody guessed it!&#160; I had hoped for a few more guesses, but c’est la vie, I suppose.&#160; In the meantime, I should fulfill my end of [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><p>About a week and a half ago <a href="http://www.davidpoll.com/?p=32" target="_blank">I issued a challenge</a> to folks to figure out what the Silverlight 3 application below does.&#160; I dropped a few hints, but nobody guessed it!&#160; I had hoped for a few more guesses, but c’est la vie, I suppose.&#160; In the meantime, I should fulfill my end of the bargain and reveal the secrets of my mystery application, and some of the things I learned while putting it together.</p>
<p>To view the app, you’ll need the Silverlight 3 Beta installed on your machine (download links here):</p>
<p>Windows:    <br /><a href="http://go.microsoft.com/fwlink/?LinkID=143433">http://go.microsoft.com/fwlink/?LinkID=143433</a>     <br />Mac:     <br /><a href="http://go.microsoft.com/fwlink/?LinkID=143434">http://go.microsoft.com/fwlink/?LinkID=143434</a></p>
<p> <object data="data:application/x-silverlight-2," type="application/x-silverlight-2" width="640" height="480px"><param name="source" value="http://www.davidpoll.com/Samples/Mystery5-8-08/MysterySilverlightApplication.xap" /><param name="onerror" value="onSilverlightError" /><param name="background" value="white" /><param name="minRuntimeVersion" value="3.0.40624.0" /><param name="autoUpgrade" value="false" /><a href="http://go.microsoft.com/fwlink/?LinkID=141205" style="text-decoration: none;">      			<img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none" /> 			</a> 		</object>
<p><iframe style="border-right-width: 0px; width: 0px; border-top-width: 0px; border-bottom-width: 0px; height: 0px; visibility: hidden; border-left-width: 0px"></iframe></p>
<p>First, let me show you the “visible” portion of my application.&#160; Pardon my slow reveal, but it will help create drama, I promise!</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">Grid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;LayoutRoot&quot; </span><span style="color: red">Background</span><span style="color: blue">=&quot;White&quot;&gt;
    &lt;</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">RowDefinition </span><span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">RowDefinition </span><span style="color: red">Height</span><span style="color: blue">=&quot;Auto&quot; /&gt;
    &lt;/</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Grid </span><span style="color: red">DataContext</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Source</span><span style="color: blue">={</span><span style="color: #a31515">StaticResource </span><span style="color: red">SampleDataSource</span><span style="color: blue">}}&quot;&gt;
        &lt;</span><span style="color: #a31515">dataControls</span><span style="color: blue">:</span><span style="color: #a31515">DataForm </span><span style="color: red">CurrentIndex</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">ElementName</span><span style="color: blue">=dg, </span><span style="color: red">Mode</span><span style="color: blue">=TwoWay, </span><span style="color: red">Path</span><span style="color: blue">=SelectedIndex}&quot; </span><span style="color: red">HorizontalAlignment</span><span style="color: blue">=&quot;Right&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;0,8,8,223&quot; </span><span style="color: red">Width</span><span style="color: blue">=&quot;267&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay, </span><span style="color: red">Path</span><span style="color: blue">=Collection}&quot;/&gt;
        &lt;</span><span style="color: #a31515">chartingToolkit</span><span style="color: blue">:</span><span style="color: #a31515">Chart </span><span style="color: red">Height</span><span style="color: blue">=&quot;211&quot; </span><span style="color: red">HorizontalAlignment</span><span style="color: blue">=&quot;Right&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;0,0,8,8&quot; </span><span style="color: red">DataContext</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay, </span><span style="color: red">Path</span><span style="color: blue">=Collection}&quot; </span><span style="color: red">VerticalAlignment</span><span style="color: blue">=&quot;Bottom&quot; </span><span style="color: red">Width</span><span style="color: blue">=&quot;267&quot; </span><span style="color: red">Title</span><span style="color: blue">=&quot;Chart Title&quot;&gt;
            &lt;</span><span style="color: #a31515">chartingToolkit</span><span style="color: blue">:</span><span style="color: #a31515">ScatterSeries </span><span style="color: red">SelectedItem</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">ElementName</span><span style="color: blue">=dg, </span><span style="color: red">Mode</span><span style="color: blue">=TwoWay, </span><span style="color: red">Path</span><span style="color: blue">=SelectedItem}&quot; </span><span style="color: red">DependentValuePath</span><span style="color: blue">=&quot;Y&quot; </span><span style="color: red">IndependentValuePath</span><span style="color: blue">=&quot;X&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay}&quot; </span><span style="color: red">AnimationSequence</span><span style="color: blue">=&quot;FirstToLast&quot; </span><span style="color: red">IsSelectionEnabled</span><span style="color: blue">=&quot;True&quot;/&gt;
        &lt;/</span><span style="color: #a31515">chartingToolkit</span><span style="color: blue">:</span><span style="color: #a31515">Chart</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;dg&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;8,8,279,223&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay, </span><span style="color: red">Path</span><span style="color: blue">=Collection}&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;&gt;
            &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid.Columns</span><span style="color: blue">&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Bar&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Bar}&quot;/&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Bat&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Bat}&quot;/&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Baz&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Baz}&quot;/&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Foo&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Foo}&quot;/&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Title&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Title}&quot;/&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;X&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=X}&quot;/&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Y&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Y}&quot;/&gt;
            &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid.Columns</span><span style="color: blue">&gt;
        &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">controls</span><span style="color: blue">:</span><span style="color: #a31515">Calendar </span><span style="color: red">Height</span><span style="color: blue">=&quot;211&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;8,0,279,8&quot; </span><span style="color: red">VerticalAlignment</span><span style="color: blue">=&quot;Bottom&quot;/&gt;
    &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">Button </span><span style="color: red">Grid.Row</span><span style="color: blue">=&quot;1&quot; </span><span style="color: red">Content</span><span style="color: blue">=&quot;Reset&quot; </span><span style="color: red">Click</span><span style="color: blue">=&quot;Button_Click&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;8,0,8,0&quot; </span><span style="color: red">Height</span><span style="color: blue">=&quot;30&quot; /&gt;
&lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;</span></pre>
<p>So there you go.&#160; The XAML is fairly simple – it uses some of the Silverlight SDK controls (DataForm, DataGrid, and Calendar) as well as the Toolkit’s Chart control.&#160; A few folks in the comments of the original post remarked on the behavior of the controls here.&#160; Some fun things to notice: the Chart, DataGrid, and DataForm are all bound to the same collection.&#160; Furthermore, their SelectedItems are all bound together as well.&#160; The result is that changing a value in the DataGrid or DataForm will move it in the chart and update its value in the other controls.&#160; All cool stuff, even though I put it in the app to throw you off!</p>
<p>You’ll notice that I used ElementName binding – new in SL3 (imported from WPF XAML) to accomplish all of this behavior.&#160; With ElementName binding and many of the other new Silverlight features, you can really make rich, dynamic applications with very little code.&#160; And with the new features in the Blend 3 preview, building this app was easier than ever.&#160; The new Sample Data feature in Blend 3 is great for prototyping:</p>
<p><a href="http://www.davidpoll.com/wp-content/uploads/2009/05/image2.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="Blend 3&#39;s Sample Data feature makes prototyping easy!" border="0" alt="Blend 3&#39;s Sample Data feature makes prototyping easy!" src="http://www.davidpoll.com/wp-content/uploads/2009/05/image-thumb1.png" width="556" height="340" /></a></p>
<p>With the Sample Data feature, you can define a data source (as I did above) and add fields that are simple (strings, ints, etc.), complex (objects on which you can add other fields&quot;), or collections.&#160; Blend will generate sample data ranging from <a href="http://en.wikipedia.org/wiki/Lorem_ipsum">lorem ipsum</a> text to random numbers.&#160; You can then bind your UI to this sample data and use the binding UI in Blend to set up your bindings:</p>
<p><a href="http://www.davidpoll.com/wp-content/uploads/2009/05/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="Editing bindings in Blend 3 is easy!" border="0" alt="Editing bindings in Blend 3 is easy!" src="http://www.davidpoll.com/wp-content/uploads/2009/05/image-thumb2.png" width="459" height="434" /></a></p>
<p>Again, very cool stuff.&#160; Blend 3 and Silverlight 3 make it really easy to construct rich UI for your application and do it quickly.&#160; All in all, building this piece of the mystery application using Blend 3 took me no more than an hour, and the only reason it took that long is that I spent some time playing with some of the Blend features and the Chart control!</p>
<p>&#160;</p>
<p><strong><em>Ok, ok, I’m stalling, I know…</em></strong></p>
<p>&#160;</p>
<p>I guess it’s time for me to reveal what the <strong><em>real</em></strong> Easter Egg is.&#160; “All of that Silverlight 3 and Blend 3 stuff is great…”, I’m sure you’re saying, “but get to the secret already!”</p>
<p>First, let me outline the hints I gave:</p>
<ul>
<li>I pointed you to <a href="http://www.gizmodo.com">gizmodo.com</a> – an article that appeared the day of the post.&#160; That morning, a fun little article about an <a href="http://gizmodo.com/5245751/the-konami-code-works-on-facebook" target="_blank">Easter Egg on a popular social networking site</a> appeared. </li>
<li>In the comments, I pointed out that the business-like functionality was too serious of a guess! </li>
<li>The Reset button actually does something. </li>
</ul>
<p>In truth, really only the first hint would give you and idea of what to do with this application.&#160; Without taking a look there, you weren’t likely to figure out what to do with my application.</p>
<p>So, if you haven’t already figured it out from my revelations above, the easter egg in my application is that the <a href="http://en.wikipedia.org/wiki/Konami_code" target="_blank">Konami Code</a> makes a super-secret special message appear!&#160; I figured if it’s good enough for Facebook, it’s good enough for me!&#160; Here’s what you need to do:</p>
<p>Click the application to give it focus.&#160; Hit the following keys:</p>
<p><strong><em>Up, Up, Down, Down, Left, Right, Left, Right, B, A</em></strong></p>
<p>And observe!</p>
<p><a href="http://www.davidpoll.com/wp-content/uploads/2009/05/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="&quot;UberCool!&quot; shown in the Mystery Application" border="0" alt="&quot;UberCool!&quot; shown in the Mystery Application" src="http://www.davidpoll.com/wp-content/uploads/2009/05/image-thumb3.png" width="443" height="333" /></a></p>
<p>And true to form, the Reset button will hid the message and allow you to re-enter the code.</p>
<p>Enabling this functionality turns out to be pretty simple.&#160; For the purposes of this mystery application, I created a KonamiCode control that simply changes its <a href="http://silverlight.net/learn/tutorials/StylesTemplatesVSM.aspx" target="_blank">visual state</a> once the code is entered.&#160; Its template uses the new easing functions (very easy to set up in a visual state transition in Blend 3) in Silverlight to animate the rotation of the “secret message.”&#160; The KonamiCode control is a ContentControl, and listens for key presses on its content.&#160; For kicks, I made the control work more generally, allowing a developer to specify the keystrokes that will trigger the visual state change.&#160; Who knows, maybe someone will find something more useful to do with it!</p>
<p>With the KonamiCode control, you too can add the Konami Code Easter Egg to your Silverlight 3 applications!&#160; It’s as simple as wrapping your UI in the control, like so:</p>
<pre class="code"><strong><em><span style="color: blue">&lt;</span><span style="color: #a31515">KonamiCode</span><span style="color: blue">:</span><span style="color: #a31515">KonamiCodeControl </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span></em></strong><span style="color: blue"><strong><em>=&quot;kcc&quot;&gt;</em></strong>
    &lt;</span><span style="color: #a31515">Grid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;LayoutRoot&quot; </span><span style="color: red">Background</span><span style="color: blue">=&quot;White&quot;&gt;
        &lt;</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">RowDefinition </span><span style="color: blue">/&gt;
            &lt;</span><span style="color: #a31515">RowDefinition </span><span style="color: red">Height</span><span style="color: blue">=&quot;Auto&quot; /&gt;
        &lt;/</span><span style="color: #a31515">Grid.RowDefinitions</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Grid </span><span style="color: red">DataContext</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Source</span><span style="color: blue">={</span><span style="color: #a31515">StaticResource </span><span style="color: red">SampleDataSource</span><span style="color: blue">}}&quot;&gt;
            &lt;</span><span style="color: #a31515">dataControls</span><span style="color: blue">:</span><span style="color: #a31515">DataForm </span><span style="color: red">CurrentIndex</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">ElementName</span><span style="color: blue">=dg, </span><span style="color: red">Mode</span><span style="color: blue">=TwoWay, </span><span style="color: red">Path</span><span style="color: blue">=SelectedIndex}&quot; </span><span style="color: red">HorizontalAlignment</span><span style="color: blue">=&quot;Right&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;0,8,8,223&quot; </span><span style="color: red">Width</span><span style="color: blue">=&quot;267&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay, </span><span style="color: red">Path</span><span style="color: blue">=Collection}&quot;/&gt;
            &lt;</span><span style="color: #a31515">chartingToolkit</span><span style="color: blue">:</span><span style="color: #a31515">Chart </span><span style="color: red">Height</span><span style="color: blue">=&quot;211&quot; </span><span style="color: red">HorizontalAlignment</span><span style="color: blue">=&quot;Right&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;0,0,8,8&quot; </span><span style="color: red">DataContext</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay, </span><span style="color: red">Path</span><span style="color: blue">=Collection}&quot; </span><span style="color: red">VerticalAlignment</span><span style="color: blue">=&quot;Bottom&quot; </span><span style="color: red">Width</span><span style="color: blue">=&quot;267&quot; </span><span style="color: red">Title</span><span style="color: blue">=&quot;Chart Title&quot;&gt;
                &lt;</span><span style="color: #a31515">chartingToolkit</span><span style="color: blue">:</span><span style="color: #a31515">ScatterSeries </span><span style="color: red">SelectedItem</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">ElementName</span><span style="color: blue">=dg, </span><span style="color: red">Mode</span><span style="color: blue">=TwoWay, </span><span style="color: red">Path</span><span style="color: blue">=SelectedItem}&quot; </span><span style="color: red">DependentValuePath</span><span style="color: blue">=&quot;Y&quot; </span><span style="color: red">IndependentValuePath</span><span style="color: blue">=&quot;X&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay}&quot; </span><span style="color: red">AnimationSequence</span><span style="color: blue">=&quot;FirstToLast&quot; </span><span style="color: red">IsSelectionEnabled</span><span style="color: blue">=&quot;True&quot;/&gt;
            &lt;/</span><span style="color: #a31515">chartingToolkit</span><span style="color: blue">:</span><span style="color: #a31515">Chart</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;dg&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;8,8,279,223&quot; </span><span style="color: red">ItemsSource</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Mode</span><span style="color: blue">=OneWay, </span><span style="color: red">Path</span><span style="color: blue">=Collection}&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;&gt;
                &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid.Columns</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Bar&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Bar}&quot;/&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Bat&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Bat}&quot;/&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Baz&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Baz}&quot;/&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Foo&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Foo}&quot;/&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Title&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Title}&quot;/&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;X&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=X}&quot;/&gt;
                    &lt;</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGridTextColumn </span><span style="color: red">Header</span><span style="color: blue">=&quot;Y&quot; </span><span style="color: red">Binding</span><span style="color: blue">=&quot;{</span><span style="color: #a31515">Binding </span><span style="color: red">Path</span><span style="color: blue">=Y}&quot;/&gt;
                &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid.Columns</span><span style="color: blue">&gt;
            &lt;/</span><span style="color: #a31515">data</span><span style="color: blue">:</span><span style="color: #a31515">DataGrid</span><span style="color: blue">&gt;
            &lt;</span><span style="color: #a31515">controls</span><span style="color: blue">:</span><span style="color: #a31515">Calendar </span><span style="color: red">Height</span><span style="color: blue">=&quot;211&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;8,0,279,8&quot; </span><span style="color: red">VerticalAlignment</span><span style="color: blue">=&quot;Bottom&quot;/&gt;
        &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">Button </span><span style="color: red">Grid.Row</span><span style="color: blue">=&quot;1&quot; </span><span style="color: red">Content</span><span style="color: blue">=&quot;Reset&quot; </span><span style="color: red">Click</span><span style="color: blue">=&quot;Button_Click&quot; </span><span style="color: red">Margin</span><span style="color: blue">=&quot;8,0,8,0&quot; </span><span style="color: red">Height</span><span style="color: blue">=&quot;30&quot; /&gt;
    &lt;/</span><span style="color: #a31515">Grid</span><span style="color: blue">&gt;
<strong><em>&lt;/</em></strong></span><strong><em><span style="color: #a31515">KonamiCode</span><span style="color: blue">:</span><span style="color: #a31515">KonamiCodeControl</span><span style="color: blue">&gt;</span></em></strong></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Anyhoo, here’s the code.&#160; You can download either just the control or the full source for the Mystery Application:</p>
<ul>
<li><a href="http://www.davidpoll.com/Download/KonamiCode.zip" target="_blank">KonamiCode Control source</a> </li>
<li><a href="http://www.davidpoll.com/Download/MysterySilverlightApplication.zip" target="_blank">Mystery Application source</a> </li>
</ul>
<p>Enjoy!&#160; And let me know what you think!&#160; Even RIA apps deserve to have a little fun, and I hope this brings countless <strike>hours</strike> minutes of entertainment to folks reading my blog! <img src='http://www.davidpoll.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>&#160;</p>
<p><strong><em></em></strong></p>
<p><strong><em></em></strong></p>
<p><strong><em>UPDATE:</em></strong> 5/19/2009 – 12:52 AM.&#160; Ok, just after I posted this, the following appeared on my WordPress admin dashboard.&#160; So perfect:</p>
<p><a href="http://www.davidpoll.com/wp-content/uploads/2009/05/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="WP-Konami WordPress plugin" border="0" alt="WP-Konami WordPress plugin" src="http://www.davidpoll.com/wp-content/uploads/2009/05/image-thumb4.png" width="291" height="84" /></a></p>
<p>Furthermore, this plugin directed me to this site:&#160; <a title="http://konamicodesites.com/" href="http://konamicodesites.com/">http://konamicodesites.com/</a></p>
<p>I’ll have to get listed!</p>
<p>&#160;</p>
<p><strong><em>P.S.</em></strong> My colleague, coworker, and fellow PM <a href="http://blogs.msdn.com/scmorris/" target="_blank">Scott Morrison</a> just returned from TechEd 2009 and posted some of the great <a href="http://blogs.msdn.com/scmorris/archive/2009/05/17/tech-ed-2009-demo-files.aspx" target="_blank">Silverlight 3 and .NET RIA Services content</a> that he demoed there.&#160; Check it out!</p>
<p><strong><em>Update: 7/11/2009 9:48 PM</em></strong> – Samples updated for Silverlight 3!</p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/05/19/playing-around-with-silverlight-3-a-late-easter-egg-hunt-revealed/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Logging Navigation in the Silverlight 3 Beta</title>
		<link>http://www.davidpoll.com/2009/05/12/logging-navigation-in-the-silverlight-3-beta/</link>
		<comments>http://www.davidpoll.com/2009/05/12/logging-navigation-in-the-silverlight-3-beta/#comments</comments>
		<pubDate>Wed, 13 May 2009 06:58:25 +0000</pubDate>
		<dc:creator>david.poll</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[Navigation]]></category>
		<category><![CDATA[Silverlight 3 Beta]]></category>

		<guid isPermaLink="false">http://www.davidpoll.com/?p=42</guid>
		<description><![CDATA[I’ve been playing around recently with my webserver – I recently switched from a hosted ASP.NET service to a virtual dedicated server, so I’m getting a chance to play with having full control over my server for the first time.&#160; I spent some time setting up logging and statistics on the server using IIS’s logging [...]]]></description>
			<content:encoded><![CDATA[<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_start --><p>I’ve been playing around recently with my webserver – I recently switched from a hosted ASP.NET service to a virtual dedicated server, so I’m getting a chance to play with having full control over my server for the first time.&#160; I spent some time setting up logging and statistics on the server using IIS’s logging feature and some 3rd party log-crunching software.&#160; Having that logging data is invaluable – among other things, it helps me know which pages folks are interested in and gives me insight into whether it’s too hard to reach certain sections of my page.&#160; With the addition of navigation controls in the Silverlight 3 Beta SDK, having a logging solution that cooperates with my web server seems only prudent!</p>
<p>Tim Heuer has a great blog post from December about using <a href="http://timheuer.com/blog/archive/2008/12/04/analytics-web-tracking-with-silverlight.aspx">event tracking with Google Analytics for Silverlight applications</a>.&#160; My impression is that this approach would work well with the new navigation controls, but I was looking for a simple solution that would add entries to my IIS logs straight from the Silverlight application (without having to add any javascript or use the HTML bridge).</p>
<p>The issue at hand is that the navigation controls use the URI fragment (text after the “#” sign in the URL) to determine which Page to navigate to in a Frame control.&#160; As a result (and rightly so), deeplinks into the Silverlight control or navigation that occurs within the Silverlight control never round-trip to the server, so there is no way for the server to log their occurrence.</p>
<p>Hence, my approach is fairly straightforward: make an HTTP request back to the hosting server that it will log any time my Frame is navigated.</p>
<p>My requirements for the experiment:</p>
<ul>
<li>Reuse the built-in logging features of my web server (IIS 7, but I imagine this would work more broadly) </li>
<li>Ensure that unique URIs within my application are logged individually (so query strings, custom URIs, etc. are not lost in the logged data) </li>
<li>Avoid limiting the application by requiring the HTML bridge to be accessible or requiring additional files to be added to my website (such as javascript files or additional ASP.NET Pages) </li>
</ul>
<p>It turns out this isn’t so difficult to do!&#160; I started with the Silverlight Navigation Application project template that ships with the <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=11dc7151-dbd6-4e39-878f-5081863cbb5d&amp;displaylang=en">Silverlight 3 Beta Tools for Visual Studio</a> that came out at MIX.&#160; This project template gets me set up with a Frame, some Pages, and some buttons that cause the Frame to navigate – everything a newborn navigation application needs to grow big and strong!</p>
<p>I began by handling the Frame control’s “Navigated” event in MainPage.xaml:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">navigation</span><span style="color: blue">:</span><span style="color: #a31515">Frame </span><span style="color: red">x</span><span style="color: blue">:</span><span style="color: red">Name</span><span style="color: blue">=&quot;Frame&quot; </span><span style="color: red">Source</span><span style="color: blue">=&quot;/Views/HomePage.xaml&quot;
                  </span><span style="color: red"><strong><em>Navigated</em></strong></span><span style="color: blue"><strong><em>=&quot;Frame_Navigated&quot;</em></strong>
                  </span><span style="color: red">HorizontalContentAlignment</span><span style="color: blue">=&quot;Stretch&quot;
                  </span><span style="color: red">VerticalContentAlignment</span><span style="color: blue">=&quot;Stretch&quot;
                  </span><span style="color: red">Padding</span><span style="color: blue">=&quot;15,10,15,10&quot;
                  </span><span style="color: red">Background</span><span style="color: blue">=&quot;White&quot;/&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>With the easy part out of the way (who knew?), I started playing with WebRequest and WebClient until I came up with something that seemed to meet my needs:</p>
<pre class="code"><span style="color: blue">private void </span>Frame_Navigated(<span style="color: blue">object </span>sender, <span style="color: #2b91af">NavigationEventArgs </span>e)
{
    <span style="color: #2b91af">Uri </span>uri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #2b91af">Application</span>.Current.Host.Source.ToString() + <span style="color: #a31515">&quot;?nav=&quot; </span>+ <span style="color: #2b91af">Uri</span>.EscapeDataString(e.Uri.ToString()));
    <span style="color: #2b91af">WebRequest </span>wc = <span style="color: #2b91af">WebRequest</span>.Create(uri);
    wc.Method = <span style="color: #a31515">&quot;POST&quot;</span>;
    wc.BeginGetResponse((res) =&gt;
    {
        <span style="color: #2b91af">WebResponse </span>wr = wc.EndGetResponse(res);
    }, <span style="color: blue">this</span>);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>I’ll walk through this line-by-line and explain my thinking:</p>
<pre class="code"><span style="color: #2b91af">Uri </span>uri = <span style="color: blue">new </span><span style="color: #2b91af">Uri</span>(<span style="color: #2b91af">Application</span>.Current.Host.Source.ToString() + <span style="color: #a31515">&quot;?nav=&quot; </span>+ <span style="color: #2b91af">Uri</span>.EscapeDataString(e.Uri.ToString()));</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Here, I needed to come up with a file I knew would be present on the server and that isn’t likely to have any semantics that I’ll be overriding by making a request.&#160; In addition, I wanted to choose a file that would uniquely identify the Silverlight application that is making the request.&#160; It seemed only logical, then to use the XAP file for my Silverlight app for this purpose!&#160; Next, I added a query string that would be sent down to the server that would uniquely identify the URI that the Frame is using.&#160; The result, if the source URI is “/Views/HomePage.xaml” (as is shown in the XAML), the resulting URI is: “http://yourservername.com/yourSilverlightApp.xap?nav=%2FViews%2FHomePage.xaml”.&#160; Ok, ok, it’s not pretty (thanks to the encoding of the URI), but it does the trick.&#160; The query string here never gets used, but it does get sent to the server and logged, which leaves me with exactly the traces I was looking for!</p>
<p>Next:</p>
<pre class="code"><span style="color: #2b91af">WebRequest </span>wc = <span style="color: #2b91af">WebRequest</span>.Create(uri);
wc.Method = <span style="color: #a31515">&quot;POST&quot;</span>;</pre>
<p><a href="http://11011.net/software/vspaste"></a>The important takeaway from these two lines is that I used the HTTP POST method.&#160; I spent a bunch of time trying to use GET to make the logging happen, but it had two critical drawbacks:</p>
<ul>
<li>Every request would re-download the XAP, which was far more data than I wanted to transfer just to get logging going </li>
<li>WebRequest and WebClient both use the browser’s cache (and I couldn’t find a workaround that didn’t involve modifying the query string, which would have scuttled my approach), so repeat-visits to the same Page in the Silverlight application didn’t ever actually reach the server and get logged </li>
</ul>
<p>Finally:</p>
<pre class="code">wc.BeginGetResponse((res) =&gt;
{
    <span style="color: #2b91af">WebResponse </span>wr = wc.EndGetResponse(res);
}, <span style="color: blue">this</span>);</pre>
<p>This just shoots off the web request.&#160; There’s nothing particularly special here aside from noting that the response is entirely ignored.</p>
<p>&#160;</p>
<p><strong><em>And that’s it!</em></strong></p>
<p>&#160;</p>
<p>Here’s the proof, straight from my IIS logs (in W3C format… IP’s redacted):</p>
<div style="border-bottom: black thin solid; border-left: black thin solid; overflow-x: auto; white-space: nowrap; border-top: black thin solid; border-right: black thin solid">
<p>2009-05-13 04:41:06 POST /Samples/LoggedSilverlightNavigation/ClientBin/LoggedSilverlightNavigation.xap nav=%2FViews%2FAboutPage.xaml &#8211; &lt;IP Redacted&gt; HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0) &#8211; 405 1496<br />
    <br />2009-05-13 04:41:06 GET / feed=rss2 &#8211; &lt;IP Redacted&gt; HTTP/1.1 Windows-RSS-Platform/2.0+(MSIE+8.0;+Windows+NT+6.1) &#8211; 304 475 </p>
<p>2009-05-13 04:41:06 POST /Samples/LoggedSilverlightNavigation/ClientBin/LoggedSilverlightNavigation.xap nav=%2FViews%2FHomePage.xaml &#8211; &lt;IP Redacted&gt; HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0) &#8211; 405 1496 </p>
<p>2009-05-13 04:41:08 POST /Samples/LoggedSilverlightNavigation/ClientBin/LoggedSilverlightNavigation.xap nav=%2FViews%2FAboutPage.xaml &#8211; &lt;IP Redacted&gt; HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0) &#8211; 405 1496 </p>
<p>2009-05-13 04:41:08 POST /Samples/LoggedSilverlightNavigation/ClientBin/LoggedSilverlightNavigation.xap nav=%2FViews%2FHomePage.xaml &#8211; &lt;IP Redacted&gt; HTTP/1.1 Mozilla/4.0+(compatible;+MSIE+8.0;+Windows+NT+6.1;+WOW64;+Trident/4.0;+SLCC2;+.NET+CLR+2.0.50727;+.NET+CLR+3.5.30729;+.NET+CLR+3.0.30729;+Media+Center+PC+6.0) &#8211; 405 1496</p>
</div>
<p>And more proof, from my 3rd party stats tool (ignore the large transfer sizes… they’re artifacts of my testing the GET method, which transferred a few hundred KB with each request):</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="AWStats Screenshot showing LoggedSilverlightNavigation.xap being queried" border="0" alt="AWStats Screenshot showing LoggedSilverlightNavigation.xap being queried" src="http://www.davidpoll.com/wp-content/uploads/2009/05/image1.png" width="593" height="167" />&#160;</p>
<p>If you’re curious to download the code (it’s not much more than what you’ve already seen!), you can find it here: <a href="http://www.davidpoll.com/Samples/Download/LoggedSilverlightNavigation.zip">LoggedSilverlightNavigation.zip</a></p>
<p>There’s definitely still room for improvement, though.&#160; One thing I’d like to get working eventually is setting the Referrer header on the HTTP request to a coherent value so that I can track <em>how</em> people get from page to page in my applications – but this is a good first step.</p>
<p>I hope you find that helpful!&#160; If anyone has any other suggestions/tips/tricks for navigation, feel free to let me know!&#160; This was just the result of my experimentation, so if you’ve got a better way, feel free to comment!</p>
<p>&#160;</p>
<p><strong><em>P.S.</em></strong> Still no correct responses to my Easter Egg hunt from my last post!&#160; Don’t give up!&#160; I’ll post the answer later this week.</p>
<p><strong><em>P.P.S. </em></strong>Mark Monster has a great post from a few months ago on his blog about <a href="http://mark.mymonster.nl/2009/02/15/tracking-silverlight-support-in-google-analytics/">tracking Silverlight support in Google Analytics</a>.&#160; I imagine you could use a similar technique to accomplish the type of logging I do here.</p>
<!-- Advanced AdSense by Jim Gaudet --><!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://www.davidpoll.com/2009/05/12/logging-navigation-in-the-silverlight-3-beta/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

