﻿<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>Ian T. Lackey (ITLackey)</title>
    <description>Open Source @ Your Service</description>
    <link>http://openlightgroup.net/Blog/tabid/58/BlogId/2/Default.aspx</link>
    <language>en-US</language>
    <managingEditor>webmaster@openlightgroup.net</managingEditor>
    <webMaster>webmaster@adefwebserver.com</webMaster>
    <pubDate>Wed, 10 Mar 2010 07:06:34 GMT</pubDate>
    <lastBuildDate>Wed, 10 Mar 2010 07:06:34 GMT</lastBuildDate>
    <docs>http://backend.userland.com/rss</docs>
    <generator>Blog RSS Generator Version 3.5.1.19887</generator>
    <item>
      <title>Dynamic ListBox Item Templates</title>
      <description>&lt;p&gt;This is a very short and sweet post about dynamically switching the ItemTemplate property of a Silverlight ListBox at runtime. First we will start with a little background of what led to this article.&lt;/p&gt;  &lt;p&gt;I am currently working on an application that contains a list of pediatric patients and their parents. I was recently given a requirement to display a parent name to one group of medical professional and the patient name to another group. However, either group should be able to toggle this display to allow searching on either the parent or patient.&lt;/p&gt;  &lt;p&gt;Knowing that in Silverlight, simple is usually the correct answer, I figured this should in fact be simple. Thankfully, I was correct and after only a few minutes I had the following solution working.&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;If&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.SearchByParent.IsChecked &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.PatientListBox.SetValue(ListBox.ItemTemplateProperty, _
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                       &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Resources("&lt;span style="color: #8b0000"&gt;PatientParentListBoxTemplate&lt;/span&gt;"))
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; &lt;span style="color: #0000ff"&gt;Else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.PatientListBox.SetValue(ListBox.ItemTemplateProperty, _
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                                       &lt;span style="color: #0000ff"&gt;Me&lt;/span&gt;.Resources("&lt;span style="color: #8b0000"&gt;PatientListBoxTemplate&lt;/span&gt;"))
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;I have created two different DataTemplates to display the appropriate information for either the parent or the patient. These are added to the UserControl.Resources and then used when dynamically setting the ItemTemplateProperty DependencyProperty of the ListBox instance. The reason the DependencyProperty is used is to avoid an InvalidCastException that is thrown if setting the ItemTemplate instance property directly.&lt;/p&gt;

&lt;p&gt;I did not come up with much on this in the brief searching I did online, so I thought I would get it out there for others.&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/81/Dynamic-ListBox-Item-Templates.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/81/Dynamic-ListBox-Item-Templates.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/81/Dynamic-ListBox-Item-Templates.aspx</guid>
      <pubDate>Mon, 08 Mar 2010 21:38:11 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=81</trackback:ping>
    </item>
    <item>
      <title>RIA Services, Windows Authentication &amp; GetUser Error</title>
      <description>&lt;p&gt;Like many other developers I have been excited to see that WCF RIA Services has gone beta and now comes with a Go-Live license. After this release my team at &lt;a href="http://peds.wustl.edu" target="_blank"&gt;Wash U&lt;/a&gt; began developing a few applications using the new RIA Services bits. We have been very impressed with the productivity increase as well as several other features that RIA provides over the previous straight up WCF services have offered in the past.&lt;/p&gt;  &lt;p&gt;All was going well, until it came time to publish the first application to the staging (user testing) server. Upon deployment the application started displaying the “Initializing Application” progress control for close to a minute.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/55/WLW-RIAServicesWindowsAuthenticationGetUserE_907-image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/55/WLW-RIAServicesWindowsAuthenticationGetUserE_907-image_thumb.png" width="183" height="71" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After which the application would throw an error: “Load operation failed for query ‘GetUser’. Unable to connect to SQL Server Database.“&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/55/WLW-RIAServicesWindowsAuthenticationGetUserE_907-image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/55/WLW-RIAServicesWindowsAuthenticationGetUserE_907-image_thumb_1.png" width="300" height="167" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;This was a very strange error since we had configured the application to use Windows authentication and where not connecting to the application’s database on the initial screen. While the application was running on our local development machines everything worked fine, the application fired up and displayed the currently logged in username in the upper right of the application. So we looked at the configuration again to see if there was anything that we missed. By default RIA is configured to use Forms authentication. (As a side note, I found this post by Brad Abrams concerning the decision on which authentication method was more common: &lt;a href="http://blogs.msdn.com/brada/archive/2009/06/04/forms-auth-windows-auth-what-is-more-common.aspx" target="_blank"&gt;Forms Auth\Windows Auth – what is more common?&lt;/a&gt; ) Given this, the default configuration looks like this (Please note this is trimmed to display only the configuration elements used by the Authentication Service): &lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;roleManager&lt;/span&gt; &lt;span style="color: #ff0000"&gt;enabled&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"true"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;authentication&lt;/span&gt; &lt;span style="color: #ff0000"&gt;mode&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Forms"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;forms&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;".RiaWinAuthExample_ASPXAUTH"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;authentication&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;profile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;properties&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"FriendlyName"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;properties&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;profile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;To get RIA to use Windows authentication on the local developer workstations we simply had to change the authentication element to the following:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;authentication&lt;/span&gt; &lt;span style="color: #ff0000"&gt;mode&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Windows"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;After verifying that the configuration published to the server did in fact contain this change we went on a hunt to find out why this would not work outside of localhost. One of the first articles we found was Tim Heuer’s post &lt;a href="http://timheuer.com/blog/archive/2009/12/10/tips-to-deploy-ria-services-troubleshoot.aspx" target="_blank"&gt;Deploying your Silverlight and WCF RIA Services application&lt;/a&gt;. This post shed a lot of light on possible details that may have been overlooked. After double checking the items mentioned in Tim’s article we continued to have the issue. (BTW: You may also need to add the System.ComponentModel.DataAnnotations.dll assembly to the list of items to set to “Copy Local” in addition to the items listed in the bin or not to bin section of the article.)&lt;/p&gt;

&lt;p&gt;After digging some more and not finding much help on &lt;Insert your favorite search engine here&gt;, I decided to do some ground up debugging. This lead to several hours of starting new RIA projects, changing something, deploying it to a server and zeroing in on the problem. Eventually I came up with the following list of issues that were causing the error.&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;The System.ComponentModel.DataAnnotations.dll was not included in the bin folder on the server.&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;This was fixed by setting the Copy Local property of the reference to true.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;We had neglected to enable impersonation in the configuration for the site. This was simply a silly mistake as we do this for all of our internal web applications.&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;Love it or hate it, we are pretty much required to use impersonation due to auditing requirements we have because of HIPAA regulations. I realize that there are other ways; however, this is the most straightforward way for us to be in compliance today. Going forward we are looking into possibly implementing other solutions.&lt;/li&gt;
  &lt;/ul&gt;

  &lt;li&gt;There are some additional configuration changes that are required when deploying to a non-developer workstation.&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;Specify the defaultProvider for the roleManager as: AspNetWindowsTokenRoleProvider&lt;/li&gt;

    &lt;li&gt;Set the enabled attribute on the profile element to false! &lt;/li&gt;

    &lt;ul&gt;
      &lt;li&gt;If you are using profiles the instead of setting this to false, the provider needs to be configured to use the proper database. If you need more information about profile providers, this article should get you started: &lt;a href="http://msdn.microsoft.com/en-us/library/014bec1k.aspx" target="_blank"&gt;ASP.NET Profile Providers&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/ul&gt;
&lt;/ol&gt;

&lt;p&gt;I realize that some of this may be the result of trying to rush the application out for demo; however, with the exception of Tim’s article there was not much on the web about deployment. Information about deploying using windows authentication is even more scarce. My hope is that this article will document all of the information in one place to save others the trouble of piecing this together for the many source I had to use.&lt;/p&gt;

&lt;h3&gt;Summary \ Solution&lt;/h3&gt;

&lt;ul&gt;
  &lt;li&gt;Check out Tim’s article to cover the RIA deployment bases.&lt;/li&gt;

  &lt;li&gt;Make sure IIS is properly configured to use Windows authentication. This is the same configuration for any other ASP.Net application that uses Windows authentication, nothing special here.&lt;/li&gt;

  &lt;li&gt;Ensure that System.ComponentModel.DataAnnotations.dll and all other referenced RIA assemblies are deployed to the bin folder on the server or RIA is installed on the server.&lt;/li&gt;

  &lt;li&gt;If you need impersonation, make sure it is specified in the configuration! (man, this one make me feel sloppy in my case)&lt;/li&gt;

  &lt;li&gt;Set the corresponding configuration elements as follows:&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;Again, this is trimmed to only show the sections the authentication service is concerned with, and the impersonation configuration is included. You may or may not need the identity element for your application. Like IIS impersonation settings are the same as any ASP.Net site, so follow the same rules regarding it.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/ul&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;identity&lt;/span&gt; &lt;span style="color: #ff0000"&gt;impersonate&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"true"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;authentication&lt;/span&gt; &lt;span style="color: #ff0000"&gt;mode&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Windows"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;roleManager&lt;/span&gt; &lt;span style="color: #ff0000"&gt;enabled&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"true"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;             &lt;span style="color: #ff0000"&gt;defaultProvider&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"AspNetWindowsTokenRoleProvider"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;profile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;enabled&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"false"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;To summarize, the issues we encountered were related to:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;ASP.Net’s default configuration attempting to use a local SQL Express database for membership, roles and providers. This was solved by using the proper configuration. For us, that meant disabling profiles altogether and changing the default role provider.&lt;/li&gt;

  &lt;li&gt;RIA assemblies are not deployed with the site by default and needed to be configured to be copied to the bin folder of the site or the RIA bits needed to be installed on the server.&lt;/li&gt;

  &lt;li&gt;Impersonation needed to be set to allow access to server side resources. (database connections, file system resources etc.)&lt;/li&gt;

  &lt;ul&gt;
    &lt;li&gt;I cannot stress enough that this may not apply to your application and needs to be considered based on your environment before enabling it. There are security philosophies that say this is an “evil” configuration.&lt;/li&gt;
  &lt;/ul&gt;
&lt;/ul&gt;

&lt;p&gt;I sure hope this saves other RIA developers some time and hair loss. Due to the voodoo that is RIA services, this was not necessarily an easy issue to figure out. I had to use Fiddler, Reflector and read several articles before it finally became clear. Once all of the pieces were exposed to the light it all made since, but brining it out of the “black magic” proved to be more challenging that it “should” have been. I guess that is the trade off for having such an easy development “story.”&lt;/p&gt;

&lt;p&gt;Either way, I must say I am really digging the power of RIA and I have to recommend it to anyone want to build stunning LOB applications. So if you haven’t already, dig in and be amazed.&lt;/p&gt;

&lt;p&gt;Happy Coding… err… Designing … umm … RIA Using. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;As always, feedback is encouraged and appreciated!&lt;/em&gt;&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/55/RIA-Services-Windows-Authentication-amp-GetUser-Error.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/55/RIA-Services-Windows-Authentication-amp-GetUser-Error.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/55/RIA-Services-Windows-Authentication-amp-GetUser-Error.aspx</guid>
      <pubDate>Thu, 17 Dec 2009 06:38:42 GMT</pubDate>
      <slash:comments>9</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=55</trackback:ping>
    </item>
    <item>
      <title>Helpful Developer Resources</title>
      <description>&lt;p&gt;In college my instructor taught us that it is not always knowing the answer but knowing where to find it. In the mindset, this post is simply a list of other blogs, twitter accounts \ lists and books that I have found helpful in the recent past. Hopefully these will point you to information that you need to build great software, enjoy your work (or at least experience less stress), and keep up on the latest news regarding development.&lt;/p&gt;  &lt;p&gt;Admittedly I have been almost 100% focused on Silverlight development, so most of these resources will reflect this. However, there are a few in the list are are more general. Also, for some of the more experienced developers, I realized that a few of these links are may have you wondering why they are including. Like the MSDN site, doesn’t everyone know about that? Well, maybe, but necessarily. So I included them for the new developers or people looking to get started.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;(…these resources are in no particular order…)&lt;/em&gt;&lt;/p&gt;  &lt;h3&gt;Favorite Blogs (other than the OpenLight Members of course :) )&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;ScottGu’s Blog: Scott is a Corporate VP in the Microsoft Developer Division, and is considered the grandfather of .Net.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Blog: &lt;a title="http://weblogs.asp.net/scottgu/" href="http://weblogs.asp.net/scottgu/"&gt;http://weblogs.asp.net/scottgu/&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;Twitter: &lt;a href="http://www.twitter.com/scottgu" target="_blank"&gt;@scottgu&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Tim Heuer’s Blog: Tim is a program manager on the Microsoft Silverlight team.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Blog: &lt;a title="http://timheuer.com/blog/" href="http://timheuer.com/blog/"&gt;http://timheuer.com/blog/&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;Twitter: &lt;a href="http://www.twitter.com/timheuer" target="_blank"&gt;@timheuer&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;John Papa’s Blog: John is a Senior Technical Evangelist for Microsoft and former Silverlight MVP.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Blog: &lt;a title="http://johnpapa.net/" href="http://johnpapa.net/"&gt;http://johnpapa.net/&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;Twitter: &lt;a href="http://www.twitter.com/John_Papa" target="_blank"&gt;@John_Papa&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Brad Abrams’ Blog: &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Blog: &lt;a title="http://blogs.msdn.com/BradA/" href="http://blogs.msdn.com/BradA/"&gt;http://blogs.msdn.com/BradA/&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;Twitter: &lt;a href="http://twitter.com/brada" target="_blank"&gt;@brada&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Nikhilk Kothari’s Blog: Nikhil is a software architect in the .NET Developer Platform group within the Developer Division at Microsoft.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Blog: &lt;a title="http://www.nikhilk.net" href="http://www.nikhilk.net"&gt;http://www.nikhilk.net&lt;/a&gt;&lt;/li&gt;      &lt;li&gt;Twitter: &lt;a href="http://twitter.com/nikhilk" target="_blank"&gt;@nikhilk&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;h3&gt;Twitter&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;Silverlight MVPs: &lt;a title="http://twitter.com/John_Papa/silverlightmvp" href="http://twitter.com/John_Papa/silverlightmvp"&gt;http://twitter.com/John_Papa/silverlightmvp&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Microsoft Silverlight Developers: &lt;a title="http://twitter.com/John_Papa/msftsilverlight" href="http://twitter.com/John_Papa/msftsilverlight"&gt;http://twitter.com/John_Papa/msftsilverlight&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Michael Washington: @adefwebserver&lt;/li&gt;    &lt;li&gt;Me: @itlackey&lt;/li&gt;    &lt;li&gt;Devin Rader: @devinrader&lt;/li&gt;    &lt;li&gt;Colin Blair: @SLColinBlair&lt;/li&gt;    &lt;li&gt;Kevin Grossnicklaus: @kvgros&lt;/li&gt;    &lt;li&gt;Bill Evjen: @billevjen&lt;/li&gt; &lt;/ul&gt;  &lt;h3&gt;Misc. Developer Sites:&lt;/h3&gt;  &lt;ul&gt;   &lt;li&gt;MSDN: Should be every .Net developers homepage (or at least one of them…). Be sure and checkout the “Learn” section for some great videos.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;URL: &lt;a title="http://msdn.microsoft.com/en-us/default.aspx" href="http://msdn.microsoft.com/en-us/default.aspx"&gt;http://msdn.microsoft.com/en-us/default.aspx&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Silverlight.Net: Everything Silverlight. Videos, Hands-On labs, tutorials and forums.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;&lt;a href="http://www.silverlight.net"&gt;http://www.silverlight.net&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Silverlight Cream: Actually an aggregate of many Silverlight focused blogs. Be sure to checkout the “Skim” page to see the most popular posts.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;URL: &lt;a href="http://www.silverlightcream.com"&gt;http://www.silverlightcream.com&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;DotNetNuke’s Blogs: A link to the articles posted by the developer’s involved in the DotNetNuke project.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;URL: &lt;a title="http://www.dotnetnuke.com/tabid/825/default.aspx" href="http://www.dotnetnuke.com/tabid/825/default.aspx"&gt;http://www.dotnetnuke.com/tabid/825/default.aspx&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Channel 9: “Channel 9 is all about the conversation.”  Great videos by some of the heavy hitters&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;URL: &lt;a title="http://channel9.msdn.com/" href="http://channel9.msdn.com/"&gt;http://channel9.msdn.com/&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Chopsticks: Growing list of great videos, mainly from conferences.&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;URL: &lt;a title="http://www.microsoft.com/belux/msdn/nl/chopsticks/default.aspx" href="http://www.microsoft.com/belux/msdn/nl/chopsticks/default.aspx"&gt;http://www.microsoft.com/belux/msdn/nl/chopsticks/default.aspx&lt;/a&gt;&lt;/li&gt;   &lt;/ul&gt; &lt;/ul&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;This is just a small list of resource you can find online to stay informed and learn the latest tricks from some great developers. Please feel free to suggest additions to this list in the comments section. I will be updating this post from time to time with new information and your suggestions are appreciated and may be included.&lt;/p&gt;  &lt;p&gt;Enjoy!&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/53/Helpful-Developer-Resources.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/53/Helpful-Developer-Resources.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/53/Helpful-Developer-Resources.aspx</guid>
      <pubDate>Thu, 10 Dec 2009 06:29:32 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=53</trackback:ping>
    </item>
    <item>
      <title>DotNetNuke, jQuery and Microsoft CDN</title>
      <description>&lt;p&gt;As you may have heard, Microsoft has created their on &lt;a href="http://www.asp.net/ajaxlibrary/cdn.ashx" target="_blank"&gt;CDN&lt;/a&gt; for delivering JavaScript libraries. Beginning in ASP.Net 4 the ability to use scripts hosted on the CDN will be built into the ScriptManager control. ScottGu demonstrated how this will work in one of his &lt;a href="http://weblogs.asp.net/scottgu/archive/2009/09/15/announcing-the-microsoft-ajax-cdn.aspx" target="_blank"&gt;blog entries&lt;/a&gt;. In addition to hosting their own AJAX library, Microsoft is also providing the jQuery library for download.&lt;/p&gt;  &lt;p&gt;I am assuming that many of us have not jumped on this bandwagon as of yet This, I’m sure, is partly due to the fact that the MS AJAX libraries that are available are all beta editions slated for release with ASP.Net 4. However, the jQuery script that is currently provide is the current production release of the library and can be used today. When the next version of ASP.Net is released the number of users with cached copies of jQuery from Microsoft’s CDN will steadily rise. This will increase the benefit of using the scripts hosted there.&lt;/p&gt;  &lt;p&gt;So in an effort to ready DotNetNuke to gain from this coming event, you can configure DNN to start pulling its jQuery script from the Microsoft CDN. Thanks to some relatively new features in DotNetNuke, this is a very simple process.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Log into the portal using a SuperUser account.&lt;/li&gt;    &lt;li&gt;Navigate to the&lt;strong&gt; Host Settings&lt;/strong&gt; page located on the &lt;strong&gt;Host&lt;/strong&gt; menu.&lt;/li&gt;    &lt;li&gt;Scroll down to the &lt;strong&gt;jQuery Settings&lt;/strong&gt; section located under Advanced Settings.&lt;/li&gt;    &lt;li&gt;Check the &lt;strong&gt;Use Hosted jQuery Version&lt;/strong&gt; checkbox.&lt;/li&gt;    &lt;li&gt;Enter the following URL into the &lt;strong&gt;Hosted jQuery URL&lt;/strong&gt; textbox. &lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;http://ajax.microsoft.com/ajax/jQuery/jquery-1.3.2.min.js&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Click &lt;strong&gt;Update&lt;/strong&gt;.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/50/WLW-DotNetNukejQueryandMicrosoftCDN_DCB-image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/50/WLW-DotNetNukejQueryandMicrosoftCDN_DCB-image_thumb.png" width="420" height="288" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;That is all there is to it. Now your DotNetNuke site will use the jQuery script on the Microsoft CDN. In the interest of full disclosure, I should state that not everyone will see a benefit from this change and each site should be evaluated independently. There is an ongoing debate on whether Microsoft developers should use Google’s CDN, Microsoft’s CDN or other hosting options when referencing the jQuery library. Be sure you do your homework to determine which is the best solution for your site(s).&lt;/p&gt;  &lt;p&gt;Happy coding… err… configuring. ;)&lt;/p&gt;  &lt;p&gt;P.S. I made a forum post here seeing what the interest of the Silverlight community is in having the Silverlight.js file hosted on the CDN. Please take a moment and post your thoughts. If enough of us support the idea, maybe Microsoft will consider adding it. &lt;a title="http://forums.silverlight.net/forums/t/147867.aspx" href="http://forums.silverlight.net/forums/t/147867.aspx"&gt;http://forums.silverlight.net/forums/t/147867.aspx&lt;/a&gt;&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/50/DotNetNuke-jQuery-and-Microsoft-CDN.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/50/DotNetNuke-jQuery-and-Microsoft-CDN.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/50/DotNetNuke-jQuery-and-Microsoft-CDN.aspx</guid>
      <pubDate>Thu, 03 Dec 2009 06:59:12 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=50</trackback:ping>
    </item>
    <item>
      <title>Silverlight Metronome</title>
      <description>&lt;p&gt;I have recently been practicing playing the bass again and during one of the practicing session my friend had suggested some features for a digital metronome. We had used a few JavaScript based ones; however none of them had a few helpful features. These features included: Adjustable tempo, support for different beats per measures, a visual counter displaying the current count of the measure, the ability to allow for multiple measures, the ability to have two different volumes for the tick sound that plays for each beat, the ability to mute the tick for specified beats of a measure and allow the metronome to be run from the computer without being connected to the internet.So since we could not find a single metronome that supported these features, I decided to build one using Silverlight, figuring that it would be a pretty simple exercise. It turns out I was right, well for the most part.&lt;/p&gt;  &lt;p&gt;Obviously the most important feature of a metronome is to keep time, this turned out to be so easy it was almost ridiculous. All that needed to be done was to create an empty storyboard with a duration of one second.&lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Storyboard&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x&lt;/span&gt;:&lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Tick"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                    &lt;span style="color: #ff0000"&gt;Duration&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"00:01:00"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;UserControl.Resources&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The an event handler was wired up to restart the story board each time it was completed, like this:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Tick.Completed += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; EventHandler(Tick_Completed);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;//Inside the event handler:&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Tick.Begin();&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Now to allow for tempos other than 60 beats per minute, I created a slider control and wired the value to the SpeedRatio of the storyboard. Unfortunately, element to element binding would not work in this case because the storyboard is a resource. So I had to wire up an event handler to the slider’s ValueChanged event that would update the SpeedRatio of the storyboard. I also needed to ensure that the value was a whole number.  A custom behavior I found here: &lt;a title="http://blogs.veracitysolutions.com/tag/behaviors/" href="http://blogs.veracitysolutions.com/tag/behaviors/"&gt;http://blogs.veracitysolutions.com/tag/behaviors/&lt;/a&gt; was all it took to snap the slider to whole number.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Slider&lt;/span&gt; &lt;span style="color: #ff0000"&gt;x&lt;/span&gt;:&lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"BeatsPerMinute"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;Minimum&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"20"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;Maximum&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"200"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;Value&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"60"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;Margin&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"0"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;Orientation&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Vertical"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;SmallChange&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"1"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;HorizontalAlignment&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"Center"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #ff0000"&gt;Height&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"180"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;i&lt;/span&gt;:&lt;span style="color: #800000"&gt;Interaction.Behaviors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;OpenLightGroup&lt;/span&gt;&lt;span style="color: #ff0000"&gt;_AgMetronome&lt;/span&gt;:&lt;span style="color: #ff0000"&gt;SnappingSliderBehavior&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;i&lt;/span&gt;:&lt;span style="color: #800000"&gt;Interaction.Behaviors&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Slider&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;With that I had the foundation laid for a metronome with an adjustable tempo. I then wired up a toggle button to control starting and stopping the metronome to allow for a different look while the metronome is running. So now we need to be able to set the number of beats per measure so we know what to count to. For this, I simply used a combobox to allow you to select from 3/4, 4/4 and 5/4 times and wired up an event handler to set a field that holds the count for each measure. Then I added some code to the tick completed event handler to track the current beat and reset it to one once the maximum count is reached based on the beats per measure that is currently selected. I also set the content of the toggle button to show what the current count is.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count++;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count &gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._maxCount)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count = 1;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.Content = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count.ToString();&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;At this point, if you click the play button the metronome will count the number of beats selected pre measure and display them in the button. You can also adjust the tempo to count faster or slower. Next, I added the ability to have multiple measure displayed so the metronome would count to the max count of the measure and below show which count it was on in all of the measures. To do this I added a wrap panel with a number of beats added to it based on the beats per measure and the number of measures selected. To allow for the feature of stressing certain beats I decided to create a beat user control that would have three states: Normal, Medium and High. These states are shown by changing the color of the text that shows the number of the beat. The state of the beat is selected by click on the beat to cycle through the options. All beats start in the normal state, but change to medium upon the first click and high on the second click. Clicking the beat a third time cycles it back to the normal state.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StressLevel++;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StressLevel &gt; 3)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StressLevel = 1;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StressLevel == 1)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.MeasureNumberText.Foreground = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NormalStressCountBrush;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StressLevel == 2)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.MeasureNumberText.Foreground = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.MediumStressCountBrush;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;else&lt;/span&gt; &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StressLevel == 3)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.MeasureNumberText.Foreground = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.HighStressCountBrush;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;When the metronome loads, it defaults to four beats per measure and only one measure which then adds four beats set to the normal state to the beats wrap panel. By clicking the up arrow on the number of measures control the proper number of beats will be added to the wrap panel. Clicking the down arrow will remove the appropriate number of beats from the wrap panel. To prevent issues with the count, the metronome is paused and then restarted once the correct number of beats are added.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; NumberOfMeasures_ValueChanged(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, RoutedPropertyChangedEventArgs&lt;&lt;span style="color: #0000ff"&gt;double&lt;/span&gt;&gt; e)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.IsChecked.HasValue &amp;&amp; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.IsChecked.Value)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Tick.Stop();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;double&lt;/span&gt; difference;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (e.NewValue &gt; e.OldValue)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        difference = (e.NewValue - e.OldValue) * &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._maxCount;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &lt; difference; i++)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.AddBeat();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        difference = (e.OldValue - e.NewValue) * &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._maxCount;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &lt; difference; i++)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Beats.Children.Count &gt; 0)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                UIElement child = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Beats.Children.Last&lt;UIElement&gt;();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Beats.Children.Remove(child);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.IsChecked.HasValue &amp;&amp; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.IsChecked.Value)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Tick.Begin();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;To show which beat the metronome is currently on within the measures I increase the border thickness and scale the beat to 1.1. This means I also need to reset the style of the previous beat each time the count is increased. I also set the color of the text of the play button equal to the color of the font of the current beat. This is done to show the current stress level inside of both the beat in the measures and the current count within the beats per measure. All of this is done inside of the tick completed event handler.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ResetPreviousBeat();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StyleCurrentBeat();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Beat currentBeat = (Beat)&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Beats.Children[&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._currentBeat];
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.Foreground = currentBeat.MeasureNumberText.Foreground;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Up until this point everything has been pretty standard coding and went fairly smoothly. Well with the exception of some silly math/logic issues with looping and adding/removing the proper number of beats when changing the number of measures. This leaves us with two features left to implement, playing the tick sound at the correct volume based on the current beats stress level and the ability to run the application “out of browser.”&lt;/p&gt;

&lt;p&gt;I will started by creating the sound file that will be used to play the “tick” sound for selected beats. To do this I used the “Generate Click Track” feature of the &lt;a href="http://audacity.sourceforge.net/" target="_blank"&gt;Audacity&lt;/a&gt; sound editor program.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/49/WLW-SilverlightMetronome_9ADC-image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/49/WLW-SilverlightMetronome_9ADC-image_thumb.png" width="240" height="119" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;After exporting the track as an mp3, I imported the mp3 into Expression Encoder to clip it to a single tick and encode it as a wma file. Once I had encoded a suitable sound file, I added a resource file to the project and added the sound file as a resource. This allows the sound file to be played when the application cannot access the hosting site. With the sound file in place, I added a media element control to the metronome control to allow the sound to be played programmatically. However, since the sound file is now compiled into the application the source has to be set during the loaded event instead of in the xaml.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;_soundStream = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; MemoryStream(SourdResource.TickSound);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.TickPlayer.SetSource(_soundStream);&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;We are finally ready to use the stress level of the current beat to determine if the sound should be played and if so at what volume level. This too is done inside of the tick completed event handler. To make the code in the tick completed event handler easier to read I made the PlayTick method to handle setting the volume and playing the sound. Notice that the position of the media element must be set to zero each time it is played.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; PlayTick(&lt;span style="color: #0000ff"&gt;double&lt;/span&gt; volume)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.TickPlayer.Volume = volume;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.TickPlayer.Position = TimeSpan.FromSeconds(0.0);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.TickPlayer.Play();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The finished tick completed event handler now looks like this:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Tick_Completed(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, EventArgs e)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;{
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count++;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count &gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._maxCount)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count = 1;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.Content = &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._count.ToString();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ResetPreviousBeat();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.StyleCurrentBeat();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    Beat currentBeat = (Beat)&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Beats.Children[&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._currentBeat];
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayButton.Foreground = currentBeat.MeasureNumberText.Foreground;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;switch&lt;/span&gt; (currentBeat.StressLevel)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 2:
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayTick(0.75);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;case&lt;/span&gt; 3:
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.PlayTick(1.0);
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;default&lt;/span&gt;:
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;break&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._currentBeat++;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._currentBeat &gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Beats.Children.Count - 1)
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._currentBeat = 0;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Tick.Begin();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;The final feature to implement is by far the easiest one. To enable the application to be run from a disconnected computer all that need to be done is to open the properties of the Silverlight application and check the “Enable running application out of the browser” checkbox.&lt;/p&gt;

&lt;p&gt;You can view the finished product at the following link: &lt;a href="http://itlackey.net/silverlight/agmetronome/default.html" target="_blank"&gt;AgMetronome&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The source code for the Silverlight project can be downloaded here: &lt;a href="http://itlackey.net/silverlight/agmetronome/agmetronome.zip" target="_blank"&gt;AgMetronome Source&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope the tutorial or the application itself proves to be useful for you. As always I appreciate any feedback, questions or comments regarding this post.&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/49/Silverlight-Metronome.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/49/Silverlight-Metronome.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/49/Silverlight-Metronome.aspx</guid>
      <pubDate>Sun, 29 Nov 2009 17:01:05 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=49</trackback:ping>
    </item>
    <item>
      <title>Using RIA Services with the ASP.Net Web Site Project (WSP) template</title>
      <description>&lt;p&gt;Maybe I am a bit to “old school” but I still prefer to use the ASP.Net Web Site project type as opposed to the ASP.Net Web Application project type. I believe this comes from the time spent developing Classic ASP sites and being used to the more “Windows-Like” development of WAP. I am not saying that I will not eventually switch to the “Dark Side” and honestly I already have embraced the Compiled Module project template for my recent DotNetNuke development. However, for now I still have several existing ASP.Net Web Sites that are in use and will not be changing to the compiled project paradigm anytime soon.&lt;/p&gt;  &lt;p&gt;This has never been an issue and I had never even considered it to be a drawback until I started learning RIA Services. It didn’t take long to notice that the RIA Services template only allows for the WAP style projects. So I started to wonder how to go about adding RIA to existing web sites. I put together a quick example of how to structure a solution to enable RIA on a stand ASP.Net Web Site. The projects look this:&lt;/p&gt;  &lt;p&gt; &lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb.png" width="225" height="74" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;strong&gt;RegularWebSite&lt;/strong&gt;: Obviously this is the regular non-compiled site, created using the ASP.Net Web Site template.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;ExampleRIAServicesApplication&lt;/strong&gt;: This is a project created using Silverlight Navigation Application template.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;ExampleRIAServicesLibrary&lt;/strong&gt;: A Silverlight class library project that was created using the WCF RIA Services Class Library project template. The template also created the next project automatically.&lt;/li&gt;    &lt;li&gt;&lt;strong&gt;ExampleRIAServicesLibrary&lt;/strong&gt;.Web: A .Net class library project that was created using the WCF RIA Services Class Library project template.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;Once these projects were created I started setting up the Domain Services that will be hosted on the ASP.Net site. To do this I first added the following references to the ExampleRIAServicesLibrary.Web:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_4.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb_1.png" width="240" height="72" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;I then added a LinqToSql model to the project and created a Domain Service to expose the entities in the model. &lt;em&gt;(To keep this post focused, I will not be discussing how to create the domain services. There are plenty of great resources on how to create these services, write custom queries, enable authentication and so on. This article is meant only to explain how to use RIA Services with a non-compiled ASP.Net site.) &lt;/em&gt;Once I had these services built (or at least started), I built the ExampleRIAServiceLibrary.Web project and verified that the code was generated in the ExampleRIAServiceLibrary project. If the code is generated, then the RIA Services link is functioning properly and you can move on to wiring this library projects to the application projects.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_10.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb_4.png" width="240" height="105" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;em&gt;Note: If the code is not generated verify that the Silverlight class library is linked to the .Net library via the .Net RIA Services link project property.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_8.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb_3.png" width="244" height="112" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt; &lt;/p&gt;  &lt;p&gt;First I added a reference to the ExampleRIAServiceLibrary project in the main Silverlight application:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_12.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb_5.png" width="228" height="76" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Then I added a reference to the ExampleRIAServiceLibrary.Web project in the RegularWebSite project:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_14.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb_6.png" width="240" height="92" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;The final step to link all of the projects together is to link the ExampleRIAServicesApplication Silverlight application to the web site:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_16.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/Portals/0/Blog/Files/2/46/WLW-RIAServicesWeb.ConfigChanges_11766-image_thumb_7.png" width="244" height="145" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now that all of the projects are linked properly, I built the solution to verify that all of the files were generated and\or copied to the appropriate locations and no errors where reported. Everything built properly so we are ready to published right? Well, actually not yet. There are a few web.config changes that need to be made to allow the Domain Services to function properly. All of the changes that need to be made should be found in the App.Config file of the ExampleRIAServiceLibrary.Web and can be copied directly into the RegularWebSite web.config. First make sure that the necessary connection strings are copied over so the Domain Services can access the data store. The two RIA Services specific settings are as follows:&lt;/p&gt;  &lt;p&gt;Under system.web-&gt;httpModules  add the following entry:  &lt;/p&gt;  &lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"DomainServiceModule"&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;                 &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"System.Web.Ria.Services.DomainServiceHttpModule, System.Web.Ria, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt; &lt;/p&gt;

&lt;p&gt;You also need a system.serviceModel section that contains the following entry: &lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;serviceHostingEnvironment&lt;/span&gt; &lt;span style="color: #ff0000"&gt;aspNetCompatibilityEnabled&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"true"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;&lt;em&gt;If your site already contains a system.serviceModel section, then simply add (or verify) the serviceHostingEnvironment settings.&lt;/em&gt;&lt;/p&gt;
&lt;em&gt;&lt;/em&gt;

&lt;p&gt;
  &lt;br /&gt;After the configuration changes are made you are ready to start building and debugging (unless you right perfect code of course) you new RIA Services enable Silverlight Application. Keep in mind while this articles describes this process using all new projects, the principals are described will work on existing projects and sites. &lt;/p&gt;

&lt;p&gt;Now go out there, grab the latest RIA Services bits (in case you haven’t heard, the beta version was released at PDC this week!) and have fun coding! And as always I appreciate and encourage your feedback, comments and questions. Thanks!&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/46/Using-RIA-Services-with-Web-Site-Project-WSP.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/46/Using-RIA-Services-with-Web-Site-Project-WSP.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/46/Using-RIA-Services-with-Web-Site-Project-WSP.aspx</guid>
      <pubDate>Sat, 21 Nov 2009 04:02:46 GMT</pubDate>
      <slash:comments>1</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=46</trackback:ping>
    </item>
    <item>
      <title>Silverlight, SEO &amp; ASP.Net – Part 3 (Version 1 Setup)</title>
      <description>&lt;p&gt;I created a package and posted it to the &lt;a href="http://silverlightseo.codeplex.com/" target="_blank"&gt;CodePlex site&lt;/a&gt; associated with this series of articles. The package aims to allow you to easily implement the strategy outlined in &lt;a href="http://openlightgroup.net/Blog/tabid/58/EntryId/25/Silverlight-SEO-amp-ASP-Net-MVC-ndash-Part-2-Solidifying-a-Strategy.aspx" target="_blank"&gt;Part 2 (Solidifying a Strategy)&lt;/a&gt; of these posts. This article will discuss how to integrate the code in the package with your existing ASP.Net site to allow links to be mapped between current urls and new Silverlight Deep Links. With the page mappings in place, you can effectively move your entire site to Silverlight while maintaining the links already indexed by the search engines. This also allows users that have not installed Silverlight and search engine bots to continue to use the original ASP.Net site.&lt;/p&gt;  &lt;p&gt;A correction is needed for some information in the previous post. Apparently, I was mistaken about needing to require the user to click a link to view the Silverlight version of the site. Google will not mark your site as a “cloaking” site because you automatically redirect the users as long as the content provided is the same on both version of the page. The end result is, users with Silverlight installed will be shown the Silverlight version of the site automatically, while all other requests (from users or search bots) will be displayed the ASP.Net version. After implementing the code provided in the download all you will have to do is ensure that the “Page Mappings” are kept up-to-date. This can be done is several ways which will discuss shortly, but let’s not get ahead of ourselves.&lt;/p&gt;  &lt;p&gt;First we need to enable the “Page Mapping” framework in our existing site. I have created a very basic example site to demonstrate the process. The site contains one page that calls a web service to retrieve the content for the page based on a query string. &lt;/p&gt;  &lt;p&gt;The site structure looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/36/WLW-SilverlightSEOA.NetPart3Version1Released_13C19-image_2.png"&gt;&lt;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="/Portals/0/Blog/Files/2/36/WLW-SilverlightSEOA.NetPart3Version1Released_13C19-image_thumb.png" width="207" height="191" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Again, this is about as simple as I could make the site and still demonstrate “data driven” content. I thought it would be important that the site use dynamic content to show how the data can be shared between ASP.Net and Silverlight. So the ContentService.asmx simply returns a string that is shown in the body of the ASP.Net page. For example, if you navigate to Default.aspx?page=about the page displays “About message from Webservice.” The Silverlight application will use this same service to provide the content for its pages. I also included a master page (Site.master) and a style sheet (DefaultStyles.css) in the site to mimic a typical ASP.Net site and allow me to demonstrate how to integrate the framework into your existing master page.&lt;/p&gt;  &lt;p&gt;Now that you have an idea of the site I will be updating we can jump into the process. Start by downloading and extracting the Silverlight SEO Install package from the &lt;a href="http://silverlightseo.codeplex.com/" target="_blank"&gt;CodePlex site&lt;/a&gt;. Once extracted you should have a folder that looks something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/36/WLW-SilverlightSEOA.NetPart3Version1Released_13C19-image_8.png"&gt;&lt;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="/Portals/0/Blog/Files/2/36/WLW-SilverlightSEOA.NetPart3Version1Released_13C19-image_thumb_3.png" width="120" height="190" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Be sure and read the README.txt in case parts of this process have changed since the writing of this post!&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Now we can begin to migrate the code from this folder into our demo website. &lt;/p&gt;  &lt;p&gt;&lt;em&gt;Please note, that before copying the files and folders to your site, be sure you are not going to overwrite any files that already exist. If you find that there is already a file with the same name, you should compare the contents and manually merge the two files. For example, robots.txt contains a Disallow for all user agents to the Silverlight.aspx page. If you already have a robots.txt file in place, simply add this entry to it. Also note that, if you site already contains the Silverlight.js file in another location there is no need to copy to your site.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Since I have verified that I have no conflicting files I will go ahead and drop all of the contents of the download into my site (except the README.txt). Now the demo site structure looks like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://openlightgroup.net/Portals/0/Blog/Files/2/36/WLW-SilverlightSEOA.NetPart3Version1Released_13C19-image_6.png"&gt;&lt;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="/Portals/0/Blog/Files/2/36/WLW-SilverlightSEOA.NetPart3Version1Released_13C19-image_thumb_2.png" width="199" height="290" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;I will now drop in the SimpleSilverlightExample.xap file for the Silverlight application I will be hosting in this site into a ClientBin folder that I will create on the site. Obviously this process will differ for you depending on if your .xap file already exists etc. &lt;/p&gt;  &lt;p&gt;Now that the Silverlight app is located in the site, I will update the Silverlight.aspx page to point to the new xap file. To do this I simply edit the source parameter of the object tag located on this page to look like this:&lt;/p&gt;  &lt;pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;param&lt;/span&gt; &lt;span style="color: #ff0000"&gt;name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"source"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"ClientBin/SimpleSilverlightExample.xap"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;While you are editing this page be sure that the Path to the Silverlight.js file is correct for your site. If the Silverlight.js file is not located in the Scripts folder, you will need to modify the ScriptReference tag inside of the MainScriptManager. &lt;/p&gt;

&lt;p&gt;By default it looks like this:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;&lt;!--Required--&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;ScriptManager&lt;/span&gt; &lt;span style="color: #ff0000"&gt;runat&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"server"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ID&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"MainScriptManager"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Scripts&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;ScriptReference&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Path&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"~/Scripts/Silverlight.js"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;ScriptReference&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Assembly&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"OpenLightGroup.PageMapping"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"OpenLightGroup.PageMapping.PageMappings.js"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Scripts&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #c71585"&gt;asp&lt;/span&gt;:&lt;span style="color: #800000"&gt;ScriptManager&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     &lt;span style="color: #008000"&gt;&lt;!--End Required—&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The only other change you may want to make on this page is, by default a link back to the ASP.Net version of the site is displayed at the bottom of the page. To hide this link uncomment the “display: none;” line the footer style at the top of the page, like this:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  .&lt;span style="color: #800000"&gt;footer&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #ff0000"&gt;text-align&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;center&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #ff0000"&gt;font-size&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;smaller&lt;/span&gt;; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;/*if you do not want to display a link to the 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            non-silverlight version of the site 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            enable the next line */&lt;/span&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #ff0000"&gt;display&lt;/span&gt;: &lt;span style="color: #0000ff"&gt;none&lt;/span&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        }&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Now let’s move on to adding the necessary code to your master page to do the automatic redirects. First open the SLSEO.master file from the download and browser through the markup. You will notice a few sections marked as “Required”, such as this:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;&lt;!--Required--&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text/javascript"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        //Used to configure the service proxy. 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        // This needs to be in all pages that call the mapping service via javascript.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        var pageMappingServicePath = '&lt;span style="background-color: #ffff00; color: black"&gt;&lt;%&lt;/span&gt;= Me.ResolveURL(ConfigurationManager.AppSettings("PageMappingServicePath")) &lt;span style="background-color: #ffff00; color: black"&gt;%&gt;&lt;/span&gt;'; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;&lt;!-- End Required –&gt;&lt;/span&gt; &lt;/pre&gt;&lt;p&gt; &lt;/p&gt;&lt;/pre&gt;

&lt;p&gt;Copy each of these sections into your own master page. Be sure to place them in the appropriate areas head, top of the body etc. As with the Silverlight.aspx, please check the path to the Silverlight.js file configured in the MainScriptManager as you copy it to your master page. If you already have a ScriptManager on your master page, you only need to copy the ScriptReferences and the script tag located directly under the ScriptManager on the SLSEO.master page.&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt; &lt;span style="color: #ff0000"&gt;type&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"text/javascript"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            &lt;span style="color: #008000"&gt;&lt;!--            //
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            //The next line automatically redirects
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            // to user the Silverlight version of the site
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            // if Silverlight is installed &lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;            RedirectToSilverlight();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;p&gt;        
           //—&gt;&lt;/p&gt;&lt;p&gt;&lt;/span&gt;&lt;/p&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;script&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Once you have merged the two master pages, you will need to add the following AppSettings to your web.config file:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;&lt;!--Required Setting for the XmlPageMappingController--&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;key&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"PageMappingsXmlFilePath"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"~/App_Data/PageMappings.xml"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;&lt;!--Required Settings --&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;key&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"PageMappingServicePath"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"~/Services/PageMappingsService.asmx"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;add&lt;/span&gt; &lt;span style="color: #ff0000"&gt;key&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"PageMappingsController"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;value&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"OpenLightGroup.PageMapping.XmlPageMappingsController, OpenLightGroup.PageMapping, PublicKeyToken=null"&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;The PageMappingsController setting configures the service to use the XML based page mappings controller. This controller uses the PageMappingsXmlFilePath setting to locate the XML file that contains the list of page mappings. This is the default data store used to keep the page mappings up-to-date; however, as mentioned before, you can develop your own controller to use a different data store. I will discuss how to build a custom controller class in a future article. For now let’s look at the PageMappings.xml file located in the App_Data folder. This file contains a list of links for the ASP.Net site and the associated Silverlight Deep Links. Since the PageMappingsController is also used to provide the search engine &lt;a href="http://www.sitemaps.org/" target="_blank"&gt;SiteMap&lt;/a&gt;, the file contains information for the sitemap as well. The XML for my example site looks like this:&lt;/p&gt;

&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 650px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;?&lt;/span&gt;xml version="1.0" encoding="utf-8" &lt;span style="color: #0000ff"&gt;?&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PageMappings&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PageMapping&lt;/span&gt; &lt;span style="color: #ff0000"&gt;htmlUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;silverlightUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Silverlight.aspx"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;order&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"1"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;priority&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"0.5"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;changeFrequency&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"always"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;lastModified&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"2009-10-01"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PageMapping&lt;/span&gt; &lt;span style="color: #ff0000"&gt;htmlUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Default.aspx"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;silverlightUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Silverlight.aspx"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;order&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"2"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;priority&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;changeFrequency&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"always"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;lastModified&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"2009-10-01"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PageMapping&lt;/span&gt; &lt;span style="color: #ff0000"&gt;htmlUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Default.aspx?page=Home"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;silverlightUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Silverlight.aspx#/Home"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;order&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"3"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;priority&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"1.0"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;changeFrequency&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"always"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;lastModified&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"2009-10-01"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;	&lt;span style="color: #0000ff"&gt;&lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PageMapping&lt;/span&gt; &lt;span style="color: #ff0000"&gt;htmlUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Default.aspx?page=About"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;silverlightUrl&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"/SeoTest/Silverlight.aspx#/About"&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;				 &lt;span style="color: #ff0000"&gt;order&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"4"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;priority&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"0.2"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;changeFrequency&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"monthly"&lt;/span&gt; &lt;span style="color: #ff0000"&gt;lastModified&lt;/span&gt;=&lt;span style="color: #0000ff"&gt;"2009-10-01"&lt;/span&gt;&lt;span style="color: #0000ff"&gt;/&gt;&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;PageMappings&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;You will need to add the appropriate entries for the links associated with your site. The priority, changeFrequency, and lastModified attributes are used by the controller to generate the search engine sitemap. The htmlUrl is the link for the ASP.Net site and the silverlightUrl is the Silverlight Deep Link associated with the htmlUrl. The order attribute is used to determine which link to redirect to if there are duplicate urls listed. For example, in my file there are two entries for “/SeoTest/Silverlight.aspx.” In this case, when redirecting the “/SeoTest” mapping would be used since it’s order comes before the “/SeoTest/Default.aspx” mapping.&lt;/p&gt;

&lt;p&gt;Once you have added the PageMapping entries to this file setup is complete and the site will begin redirecting to the appropriate link based on the availability of the Silverlight plug-in.&lt;/p&gt;

&lt;p&gt;In the previous article I stated the following objectives for this code:&lt;/p&gt;

&lt;h4&gt;&lt;strong&gt;Project Objectives:&lt;/strong&gt;&lt;/h4&gt;

&lt;ol&gt;
  &lt;li&gt;Provide a way to associate Silverlight Deep Links to a corresponding HTML version of a page and vice versa. &lt;/li&gt;

  &lt;li&gt;Allow link mappings to be data driven. &lt;/li&gt;

  &lt;li&gt;Provide a master page that will handle the redirection to the associated Silverlight link. 
    &lt;ul&gt;
      &lt;li&gt;Master page will also display the “Get Microsoft Silverlight” image link be default. This lets users know there is a Silverlight version of the site and shows them where to download the Silverlight Plug-In. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;Provide a Silverlight hosting page that will handle displaying a link to the HTML version of the page to users. 
    &lt;ul&gt;
      &lt;li&gt;Search engines will only be able to see a link to the default html page. &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;

  &lt;li&gt;Prevent search engines from indexing the page(s) that host the Silverlight content. &lt;/li&gt;

  &lt;li&gt;Provide a swappable search engine sitemap handler, that can be used to submit to search engines. &lt;/li&gt;

  &lt;li&gt;Demonstrate a basic example of how to share data driven content between Silverlight and HTML. &lt;/li&gt;

  &lt;li&gt;Provide Visual Studio templates for ASP.Net and ASP.Net MVC web sites. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Objectives 1-6 are handled by the setup process we just completed and this article completed number seven. That leaves us with number eight. While working on getting this package together it occurred to me that the value of providing templates was relatively low. So for now I am removing that objective from the list as well as providing support for the MVC framework. Technically speaking, everything in this package should work in the MVC framework if with a slightly different setup process and additional changes to Silverlight.aspx to remove the need for the ScriptManager server control. However, I was more focused on getting out the initial release with support for a typical ASP.Net site than delaying the release any longer to focus on MVC sites. I have created some items in the Issue Tracker for this project to allow you to vote on what features you would like to see most. MVC support is one of them, so if you are interested in using this framework with an MVC site, cast your vote for that feature.&lt;/p&gt;

&lt;p&gt;From my perspective the biggest drawback to this framework as it comes out of the box, is the PageMappings.xml file. For large sites with dynamic urls this could be a nightmare to manage. This brings us back to the issue of creating your own PageMappingsController class to better handle the more complex scenarios. I hope to dive into this process in my next article sometime soon. However, for those that cannot wait (and do not mind figuring some things out on their own), here is a brief description to point you in the right direction.&lt;/p&gt;

&lt;p&gt;Creating your own controller boils down to inheriting from the OpenLightGroup.PageMappings.BasePageMappingController class and updating the PageMappingsController setting in web.config. The process is really rather simple… but that is all I have time to say for now. Check out the next article for a detailed example. In the meantime, if you have any issues using the framework please post them to the &lt;a href="http://silverlightseo.codeplex.com/Thread/List.aspx" target="_blank"&gt;Discussions&lt;/a&gt; page on the &lt;a href="http://silverlightseo.codeplex.com/" target="_blank"&gt;CodePlex site&lt;/a&gt;. Also, don’t forget to vote for the features you would like to see in the next release or add features (or bugs) using the &lt;a href="http://silverlightseo.codeplex.com/WorkItem/List.aspx" target="_blank"&gt;Issue Tracker&lt;/a&gt; on the &lt;a href="http://silverlightseo.codeplex.com/" target="_blank"&gt;CodePlex site&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I hope you enjoyed this article and find the framework useful. As always please leave your (much appreciated feedback) on the article here. &lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/36/Silverlight-SEO-amp-ASP-Net-ndash-Part-3-Version-1-Setup.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/36/Silverlight-SEO-amp-ASP-Net-ndash-Part-3-Version-1-Setup.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/36/Silverlight-SEO-amp-ASP-Net-ndash-Part-3-Version-1-Setup.aspx</guid>
      <pubDate>Fri, 09 Oct 2009 07:00:06 GMT</pubDate>
      <slash:comments>2</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=36</trackback:ping>
    </item>
    <item>
      <title>Drink … err … Tweet Responsibly</title>
      <description>&lt;p&gt;So thanks to the instructor (&lt;a href="http://geekswithblogs.net/kgrossnicklaus/Default.aspx" target="_blank"&gt;Kevin Grossnicklaus&lt;/a&gt;) of a Silverlight class I just attended, I have finally started to use twitter. Believe me, this was not an easy decision for me to make. I have seen many good people fall prey to the evil that is social networking sites. I must admit, I have made my fair share of jokes about the “tweeters” out there and had to eat a little crow when I told my wife that I signed up for an account.&lt;/p&gt;  &lt;p&gt;The reason I was so resistant to twitter is all of the utterly useless information that is posted to that site. For example, I have no need or desire to know that someone is looking at a cloud shaped like a rabbit. I am sorry, but please do not clutter the information super highway with debris such as this. I mean, if I am next to you and you say “hey that cloud looks like a rabbit” that is great I will check it out. However, if you are in China and I am in the USA why do I need to know that?&lt;/p&gt;  &lt;p&gt;So the point is, when you (and I now) are tweeting we should keep in mind that twitter is a tool and like most tools it can be used incorrectly. Please tweet responsibly before someone gets hurt, useless information overload is a real condition and should be taken seriously.&lt;/p&gt;  &lt;hr /&gt;  &lt;p&gt;No before some angry tweeter start posting hateful comments let me say. This post is not to be taken too seriously. I meant it to be somewhat comical; however, a lot of truth is said in jest. To clarify, the point of the post is that if some is following you because you are a known expert on a subject, do not make them scroll through 50 tweets about random stuff to find the one post that concerns the topic they are concerned with. I do not see any problem with having a personal twitter account that is used between friends. These statements are directed only at “professional” twitter accounts. I do believe there should be a distinction. &lt;/p&gt;  &lt;p&gt;Please keep in mind this is all just my humble opinion and again I do not mean to offend anyone or start a twitter war. &lt;/p&gt;  &lt;p&gt;   &lt;hr /&gt;&lt;/p&gt;  &lt;p&gt;&lt;script src="http://widgets.twimg.com/j/1/widget.js"&gt;&lt;/script&gt;&lt;link rel="stylesheet" type="text/css" href="http://widgets.twimg.com/j/1/widget.css" /&gt;&lt;script&gt;
new TWTR.Widget({
  profile: true,
  id: 'twtr-profile-widget',
  loop: true,
  width: 250,
  height: 300,
  theme: {
    shell: {
      background: '#3082af',
      color: '#ffffff'
    },
    tweets: {
      background: '#ffffff',
      color: '#444444',
      links: '#1985b5'
    }
  }
}).render().setProfile('itlackey').start();
&lt;/script&gt;So please do leave angry comments, and if you do… well I will just tweet about how mean you are on the most popular accounts so that everyone can see it. ;)&lt;/p&gt;  &lt;p&gt;For everyone else, be sure and follow me (&lt;a title="http://twitter.com/itlackey" href="http://twitter.com/itlackey"&gt;http://twitter.com/itlackey&lt;/a&gt;) so that you can see who all of the mean people are and stay informed about all of the animal shaped clouds!&lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/35/Drink-hellip-err-hellip-Tweet-Responsibly.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/35/Drink-hellip-err-hellip-Tweet-Responsibly.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/35/Drink-hellip-err-hellip-Tweet-Responsibly.aspx</guid>
      <pubDate>Thu, 08 Oct 2009 03:40:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=35</trackback:ping>
    </item>
    <item>
      <title>Remember Me?</title>
      <description>&lt;p&gt; So I do know that "ironic" is the right word for that fact that my first post after ... way too long ... is entitled "Remember Me?" but it fitting in more than one way.&lt;/p&gt;
&lt;p&gt;Michael brought this post to my attention : &lt;a target="_blank" href="http://www.dotnetnuke.com/Community/Blogs/tabid/825/EntryId/1784/a-new-solution-to-an-old-problem.aspx"&gt;www.dotnetnuke.com/Community/Blogs/tabid/825/EntryId/1784/a-new-solution-to-an-old-problem.aspx&lt;/a&gt; dealing with DotNetNuke's issue of not respecting the "Remember Me" checkbox when logging into a site.&lt;/p&gt;&lt;a href=http://openlightgroup.net/Blog/tabid/58/EntryId/34/Remember-Me.aspx&gt;More...&lt;/a&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/34/Remember-Me.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/34/Remember-Me.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/34/Remember-Me.aspx</guid>
      <pubDate>Tue, 06 Oct 2009 02:34:00 GMT</pubDate>
      <slash:comments>0</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=34</trackback:ping>
    </item>
    <item>
      <title>C# is better! Well at least for project linking and complier directives for attributes.</title>
      <description>&lt;p&gt;So I have been one of a dwindling number of VB.Net advocates since I moved from Classic ASP (or  in other words shortly after the dinosaurs went extinct and the wheel was invented). However, today was the first time I had to use C# because I simply could handle how I had to code the VB. Don’t get me wrong I am actually language agnostic and truly believe that any .Net developer worth their salt should be able to code in either C# or VB. I use C# for a few projects, but usually default to VB for production application because it is my “native” language. I figured I should preface this article with these statements in hopes of preventing the typical language wars that ensue when topics like this are addressed. Now to the point.&lt;/p&gt;  &lt;p&gt; I have recently started an application for my employer (&lt;a href="http://peds.wustl.edu/" target="_blank"&gt;Washington University School of Medicine – Pediatrics Department&lt;/a&gt;) that would be built in Silverlight 3. It all began as every other project I have built for them, and then things took a nasty turn. I had created a set of DTOs to be used in the bottom ASP.Net layers to map the entity objects to Serializable objects to be exposed via ASMX web services. This all worked fine, until I began to bind them to the DataGrid and DataForm controls. It quickly occurred to me that I need to add Data Annotations to the properties to control the UI functionality. However, since I was using ASMX services the objects were actually recreated in the auto generated proxy code for the Silverlight project. &lt;/p&gt;  &lt;p&gt;Great, now what?!? If I edit this code and add the attributes I need it will be overwritten. I thought about creating two sets of DTOs, one for ASP.Net and one for Silverlight. This would allow me to use the attributes Silverlight needs. Hmm, that is starting to smell. Going a step further, that means I would have to map the data object to the ASP.Net DTOs and then map the proxy objects to the Silverlight DTOs. Alright that is just rancid, there is no way I am doing that!!!&lt;/p&gt;  &lt;p&gt;Then I remembered a neat little tool called &lt;a title="Project Linker Information" href="http://msdn.microsoft.com/en-us/library/dd458870.aspx" target="_blank"&gt;Project Linker&lt;/a&gt; I had seen at TechEd earlier this year. So off I went to &lt;a title="ProjectLinker Download - Be sure this is the latest release!" href="http://compositewpf.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=22566" target="_blank"&gt;download&lt;/a&gt; and install this handy add-in. No problem, it installed just fine and after a restart of visual studio I was able to create a Silverlight class library and link a standard Class Library to it. Perfect, now I am getting somewhere, but wait, not so fast! The DataAnnotations are only available in Silverlight projects so I will need to use a &lt;a title="C# Compiler Directive Information" href="http://msdn.microsoft.com/en-us/library/ed8yd1ha.aspx" target="_blank"&gt;compiler directive&lt;/a&gt; to instruct the compiler to ignore these attributes in the standard class library project. This should be no problem right, I mean what’s the big deal just put a # before your if statement and viola! &lt;/p&gt;  &lt;pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; width: 600px; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #fbfbfb"&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;If&lt;/span&gt; SILVERLIGHT &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;System.ComponentModel.DataAnnotations.Display(Name:="&lt;span style="color: #8b0000"&gt;First Name&lt;/span&gt;")&gt; _
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Property&lt;/span&gt; FirstName() &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;Get&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;            &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; _firstName
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Get&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;Set&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; value &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;            _firstName = value
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Set&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Property&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Umm, nice try but what about the line continuation!?! This will give you the dreaded blue squiggles and messages stating “#If' block must end with a matching '#End If'.”  and “Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.” So I shuffled things around a bit and came up with this:&lt;/p&gt;

&lt;pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; width: 600px; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #fbfbfb"&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt; Person
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;Private&lt;/span&gt; _firstName &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;If&lt;/span&gt; SILVERLIGHT &lt;span style="color: #0000ff"&gt;Then&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;System.ComponentModel.DataAnnotations.Display(Name:="&lt;span style="color: #8b0000"&gt;First Name&lt;/span&gt;")&gt; _
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Property&lt;/span&gt; FirstName() &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;Else&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;Public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Property&lt;/span&gt; FirstName() &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;If&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;Get&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;            &lt;span style="color: #0000ff"&gt;Return&lt;/span&gt; _firstName
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Get&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;Set&lt;/span&gt;(&lt;span style="color: #0000ff"&gt;ByVal&lt;/span&gt; value &lt;span style="color: #0000ff"&gt;As&lt;/span&gt; &lt;span style="color: #0000ff"&gt;String&lt;/span&gt;)
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;            _firstName = value
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Set&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Property&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;span style="color: #0000ff"&gt;End&lt;/span&gt; &lt;span style="color: #0000ff"&gt;Class&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Well this works, but again the solution is starting to smell. The readability of this code just plummeted and who really wants to define the property twice?!? Nope, I am too Type A for this solution. So being completely frustrated at this point I had to walk away for a bit to clear my mind and wait for the "eureka” moment to hit. After a few minutes, it did! Use C# it should work without having to duplicate your property definitions! I went back and sat down to try it out and this is what I came up with:&lt;/p&gt;

&lt;pre style="border-right: #cecece 1px solid; padding-right: 5px; border-top: #cecece 1px solid; padding-left: 5px; min-height: 40px; padding-bottom: 5px; overflow: auto; border-left: #cecece 1px solid; width: 600px; padding-top: 5px; border-bottom: #cecece 1px solid; background-color: #fbfbfb"&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Net;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; SILVERLIGHT
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.ComponentModel.DataAnnotations;
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#endif
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; Common
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;{
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Person
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    {
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#&lt;span style="color: #0000ff"&gt;if&lt;/span&gt; SILVERLIGHT
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        [Display(Name="&lt;span style="color: #8b0000"&gt;First Name&lt;/span&gt;")]
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;#endif
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; FirstName { &lt;span style="color: #0000ff"&gt;get&lt;/span&gt;; &lt;span style="color: #0000ff"&gt;set&lt;/span&gt;; }
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;    }
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;}
&lt;/pre&gt;&lt;pre style="font-size: 12px; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; background-color: #fbfbfb"&gt;&lt;/pre&gt;&lt;/pre&gt;

&lt;p&gt;Are you kidding me!?!?! Seriously, that is so much better than the VB solution! My property is now one line long, the attribute is enclosed in the compiler directive and life is good! &lt;/p&gt;

&lt;p&gt;Now I am not saying that I am switching to coding everything in C#, but I am saying that if you are wanting to share code between Silverlight and standard .Net libraries C# is a must. Thanks to the goodness of .Net I was able to keep all of my other code as-is in VB, and simply extract all of my DTOs into the linked C# libraries. Once, I got over this hurdle the refactor took less than an hour to convert all of the reference and recreate all of the DTOs in C#.&lt;/p&gt;

&lt;p&gt;One last gotcha, I could not get Visual Studio to “Reuse types in all referenced assemblies” while consuming ASMX web services. I also had to convert my web services to Silverlight enabled WCF services before the generated proxy would actually use the DTO from the Silverlight library. I did not spend much time trying to figure this out and see if there was a work around. In this case, it really made little difference to me if the service was ASMX or WCF. Just thought I would drop that nugget into the article while I was at it. &lt;/p&gt;

&lt;p&gt;I hope this helps, happy translating! &lt;/p&gt;</description>
      <link>http://openlightgroup.net/Blog/tabid/58/EntryId/26/C-is-better-Well-at-least-for-project-linking-and-complier-directives-for-attributes.aspx</link>
      <author>webmaster@openlightgroup.net</author>
      <comments>http://openlightgroup.net/Blog/tabid/58/EntryId/26/C-is-better-Well-at-least-for-project-linking-and-complier-directives-for-attributes.aspx#Comments</comments>
      <guid isPermaLink="true">http://openlightgroup.net/Blog/tabid/58/EntryId/26/C-is-better-Well-at-least-for-project-linking-and-complier-directives-for-attributes.aspx</guid>
      <pubDate>Wed, 05 Aug 2009 05:21:56 GMT</pubDate>
      <slash:comments>6</slash:comments>
      <trackback:ping>http://openlightgroup.net/DesktopModules/Blog/Trackback.aspx?id=26</trackback:ping>
    </item>
  </channel>
</rss>