<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rssdatehelper="urn:rssdatehelper" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" version="2.0"><channel><title>Pete Brown's Blog (POKE 53280,0) for tag Silverlight</title><link>http://10rem.net</link><pubDate /><description>Pete Brown writes on a variety of topics from XAML with the Windows Runtime (WinRT), .NET programming using C#, WPF, Silverlight, XNA, and Windows Phone, Microcontroller programming with .NET Microframework, .NET Gadgeteer and even plain old C, to raising two children in the suburbs of Maryland, woodworking, CNC and generally "making physical stuff". Oh, and Pete loves retro technology, especially Commodore (C64 and C128). If the content interests you, please subscribe using the subscription link to the right of every page.</description><generator>umbraco</generator><language>en-us</language><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/PeteBrown-Silverlight" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="petebrown-silverlight" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><geo:lat>39.004</geo:lat><geo:long>-76.65264</geo:long><image><link>http://www.irritatedVowel.com/blog</link><url>http://www.irritatedvowel.com/pub/blog/pete_brown_headshot_144x144.jpg</url><title>Pete Brown</title></image><item><title>Using async and await in Silverlight 5 and .NET 4 in Visual Studio 11 with the async targeting pack</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/05/22/using-async-and-await-in-silverlight-5-and-net-4-in-visual-studio-11-with-the-async-targeting-pack</link><pubDate>Tue, 22 May 2012 21:13:39 GMT</pubDate><guid>http://10rem.net/blog/2012/05/22/using-async-and-await-in-silverlight-5-and-net-4-in-visual-studio-11-with-the-async-targeting-pack</guid><description>&lt;p&gt;Last September, I &lt;a
href="http://10rem.net/blog/2011/09/04/simplifying-async-networking-with-tasks-in-silverlight-5"
 target="_blank"&gt;introduced the idea of Tasks in Silverlight&lt;/a&gt;.
One of the things I really like about .NET 4.5, and the C# compiler
that comes with it, is the ability to simplify asynchronous code by
using the async modifier and await operator. Just yesterday, I &lt;a
href="http://10rem.net/blog/2012/05/21/under-the-covers-of-the-async-modifier-and-await-operator-in-net-45-and-c-metro-style-applications"
 target="_blank"&gt;posted a bit on how these two keywords are used by
the compiler to take care of all the heavy lifting of asynchronous
code&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The key thing to note here is that &lt;strong&gt;the work is done by
the compiler, not the runtime&lt;/strong&gt;. That means that if you can
use the latest C# compiler, you can take advantage of this new
feature. A grasp of the async pattern and these two keywords will
also help prepare you for Windows Metro development. &lt;strong&gt;Note
that Silverlight doesn't have the same "asynchronous everywhere"
set of APIs that you'll find in WinRT or .NET 4.5 so async and
await won't be quite as useful here as they are there, but there's
some help for that too (read on).&lt;/strong&gt; You can still create
your own async methods, however, which is especially useful if you
plan to share code with a WinRT XAML application.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I'll focus on Silverlight 5 here, but understand that this works
with .NET 4 in VS11 as well. Note also that I'm using Visual Studio
11 beta for this post, so final details may change when VS11 is
released. Also, Visual Studio 11 and the compiler which supports
async/await requires Windows 7 or Windows 8. This will not work on
Windows XP or a Commodore 128.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In Visual Studio, create a new Silverlight application.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/85153/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_4.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/85158/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_thumb_1.png" width="650" height="329" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Choose all the normal options in the project creation dialog
(yes, create a new site, no on RIA)&lt;/p&gt;

&lt;p&gt;For the MainPage.xaml, add a single button and wire up an event
handler.&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;UserControl x:Class="SilverlightAsyncDemo.MainPage"&lt;br /&gt;
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br /&gt;
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"&lt;br /&gt;
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"&lt;br /&gt;
    mc:Ignorable="d"&lt;br /&gt;
    d:DesignHeight="300" d:DesignWidth="400"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Grid x:Name="LayoutRoot" Background="White"&amp;gt;&lt;br /&gt;
        &amp;lt;Button x:Name="TestAsync"&lt;br /&gt;
                Content="Press Me!"&lt;br /&gt;
                FontSize="25"&lt;br /&gt;
                Width="200"&lt;br /&gt;
                Height="75"&lt;br /&gt;
                Click="TestAsync_Click" /&amp;gt;&lt;br /&gt;
    &amp;lt;/Grid&amp;gt;&lt;br /&gt;
&amp;lt;/UserControl&amp;gt;
&lt;/pre&gt;

&lt;p&gt;The next step is to add the &lt;a
href="http://www.microsoft.com/en-us/download/details.aspx?id=29576"
 target="_blank"&gt;Async Targeting Pack&lt;/a&gt;. I'll use NuGet to grab
it.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/85163/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_7.png" width="446" height="390" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;p&gt;Pick your favorite way to use NuGet. Some prefer the console.
I'm going to use the project's context menu and select "Manage
NuGet Packages". From there, I'll search for
AsyncTargetingPack.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/85168/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_9.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/85173/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_thumb_3.png" width="650" height="337" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once you see it, click "Install", accept the terms (maybe even
read them first), then close the NuGet package manager. You'll
notice that the Silverlight project now includes a reference to the
Microsoft.CompilerServices.AsyncTargetingPack Silverlight 5
library.&lt;/p&gt;

&lt;h3&gt;A simple example using await&lt;/h3&gt;

&lt;p&gt;If you have a call which uses the async callback pattern, such
as with a WebClient in Silverlight, using await is pretty easy, due
to the built-in extension methods:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private async void TestAsync_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    var uri = new Uri("http://localhost:10697/SilverlightAsyncDemoTestPage.html");&lt;br /&gt;
       &lt;br /&gt;
    var client = new WebClient();&lt;br /&gt;
&lt;br /&gt;
    var results = await client.DownloadStringTaskAsync(uri);&lt;br /&gt;
&lt;br /&gt;
    Debug.WriteLine(results);&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Note that the event handler must be marked as async in order to
use the await keyword.&lt;/p&gt;

&lt;p&gt;These extension methods, DownloadStringTaskAsync in this
example, are included in the AsyncCompatLibExtensions installed
with the async targeting pack.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/85178/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_17.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/85183/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_thumb_7.png" width="650" height="524" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The extension methods mimic many of the same async functions
already available in .NET 4.5. That's great for compatibility and
to help reduce how many different approaches you need to learn.&lt;/p&gt;

&lt;h3&gt;Give me something to wait on&lt;/h3&gt;

&lt;p&gt;"Hey teacher! I've got my pencil! Now give me something to write
on." - Pre-geriatric David Lee Roth&lt;/p&gt;

&lt;p&gt;Let's do something a little more typical. In this case, I'm
going to create a web service that we'll use asynchronously.&lt;/p&gt;

&lt;p&gt;In the web project, create a "Services" folder and in that,
create a new Silverlight-Enabled Web Service named
CustomerService.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
using System;&lt;br /&gt;
using System.Collections.Generic;&lt;br /&gt;
using System.Linq;&lt;br /&gt;
using System.Runtime.Serialization;&lt;br /&gt;
using System.ServiceModel;&lt;br /&gt;
using System.ServiceModel.Activation;&lt;br /&gt;
&lt;br /&gt;
namespace SilverlightAsyncDemo.Web.Services&lt;br /&gt;
{&lt;br /&gt;
    [ServiceContract(Namespace = "uri:demo.silverlight.async")]&lt;br /&gt;
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]&lt;br /&gt;
    public class CustomerService&lt;br /&gt;
    {&lt;br /&gt;
        [OperationContract]&lt;br /&gt;
        public List&amp;lt;Customer&amp;gt; GetCustomers()&lt;br /&gt;
        {&lt;br /&gt;
            string[] firstNames = new string [] {"Pete", "Joe", "Ima", "John", "Jim", "Scott", "George", "Frank", "Al", "Jeremy", "Jason", "Alex", "Bob", "Bill", "William", "Severus", "Johnny", "Albus", "Han", "Harry", "Chris", "Christine", "Kristen", "Amy", "Leia", "Erin", "Heather", "Melissa", "Abby", "Ben", "Alice", "Morgan", "Chip"};&lt;br /&gt;
            string[] lastNames = new string [] {"Brown", "Jones", "Braxton", "Huxley", "Solo", "Organa", "Vader", "Skywalker", "Potter", "Dumbledore", "Snape", "Avatar", "Cranks", "Bravo", "Grime", "Gee", "A.", "B.", "C.", "D.", "E.", "Z.", "X.", "Walker", "Franklin", "Moore", "Less"};&lt;br /&gt;
&lt;br /&gt;
            Random rnd = new Random();&lt;br /&gt;
            const int CustomerCount = 200;&lt;br /&gt;
&lt;br /&gt;
            var customers = new List&amp;lt;Customer&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
            // generate a bunch of dummy customer data&lt;br /&gt;
            for (int i = 0; i &amp;lt; CustomerCount; i ++)&lt;br /&gt;
            {&lt;br /&gt;
                int firstIndex = rnd.Next(0, firstNames.Length-1);&lt;br /&gt;
                int lastIndex = rnd.Next(0, lastNames.Length-1);&lt;br /&gt;
&lt;br /&gt;
                customers.Add(&lt;br /&gt;
                    new Customer()&lt;br /&gt;
                        {&lt;br /&gt;
                            FirstName = firstNames[firstIndex],&lt;br /&gt;
                            LastName = lastNames[lastIndex]&lt;br /&gt;
                        });&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return customers;&lt;br /&gt;
&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    public class Customer&lt;br /&gt;
    {&lt;br /&gt;
        public string LastName { get; set; }&lt;br /&gt;
        public string FirstName { get; set; }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;Build the solution, and then add a service reference from the
Silverlight client. When creating the service reference, name the
namespace "Services". But before you leave this dialog, we have one
VERY important thing to check. Click the "Advanced" button&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/85188/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_11.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/85193/Windows-Live-Writer_Using-async-and-await-in-Silverlig.NET-4_C022_image_thumb_4.png" width="450" height="464" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Foiled! We can't generate task-based service references. Why?
Well, Silverlight didn't have the necessary support until the async
targeting pack. So, we'll have to do this manually. If you were
using .NET 4, you could simply generate Task-based operations and
be done with it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;NOTE&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If we were using RESTful calls, the "add service reference"
stuff doesn't come into play at all - it's all just
POST/GET/DELETE/PUT/PATCH with a URL. SOAP, which is what many
folks use behind the firewall, is more difficult to work with, so
the service reference helps. I'm a big fan of the ASP.NET Web API
and RESTful services. You should check them out.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;Creating an async-friendly wrapper for the service
reference&lt;/h3&gt;

&lt;p&gt;Making your service method awaitable certainly makes it easier
to consume by other developers, and easier to work into your own
application workflow (especially if you have service calls that
rely on the results of other service calls). The code to make it
awaitable is not very complicated at all. However, I like to put
this type of code into a separate service proxy or client class in
the Silverlight project.&lt;/p&gt;

&lt;p&gt;I created a new project folder named "Services" in the
Silverlight project. In that, I added a new class named
"CustomerServiceProxy". The code for the proxy is as follows:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
using System.Collections.ObjectModel;&lt;br /&gt;
using System.Threading.Tasks;&lt;br /&gt;
&lt;br /&gt;
namespace SilverlightAsyncDemo.Services&lt;br /&gt;
{&lt;br /&gt;
    public class CustomerServiceProxy&lt;br /&gt;
    {&lt;br /&gt;
        public static Task&amp;lt;ObservableCollection&amp;lt;Customer&amp;gt;&amp;gt; GetCustomers()&lt;br /&gt;
        {&lt;br /&gt;
            var tcs = new TaskCompletionSource&amp;lt;ObservableCollection&amp;lt;Customer&amp;gt;&amp;gt;();&lt;br /&gt;
&lt;br /&gt;
            var client = new CustomerServiceClient();&lt;br /&gt;
&lt;br /&gt;
            client.GetCustomersCompleted += (s,e) =&amp;gt;&lt;br /&gt;
                {&lt;br /&gt;
                    if (e.Error != null)&lt;br /&gt;
                        tcs.TrySetException(e.Error);&lt;br /&gt;
                    else if (e.Cancelled)&lt;br /&gt;
                        tcs.TrySetCanceled();&lt;br /&gt;
                    else&lt;br /&gt;
                        tcs.TrySetResult(e.Result);&lt;br /&gt;
                };&lt;br /&gt;
&lt;br /&gt;
            client.GetCustomersAsync();&lt;br /&gt;
&lt;br /&gt;
            return tcs.Task;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The code for this was adapted from the Task-based Asynchronous
Pattern whitepaper listed under "Additional Information" below. The
task is set up to return an ObservableCollection of Customers,
which is (by default) what the service reference code generation
created for me in the CustomerServiceClient class. (I also love how
we managed to get both spellings of Canceled into the same method
O_o.)&lt;/p&gt;

&lt;p&gt;Once you have the proxy created, it may be used from the
ViewModel, or any other code. Here it is in the button-click code
on MainPage. As before, the event handler has been marked with the
async modifier in order to support using the await operator.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private async void TestAsync_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    var customers = await CustomerServiceProxy.GetCustomers();&lt;br /&gt;
&lt;br /&gt;
    foreach (Customer c in customers)&lt;br /&gt;
    {&lt;br /&gt;
        Debug.WriteLine(c.FirstName + " " + c.LastName);&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;This can serve as a good starting point for your own code. Not
only will it make your async code easier to work with when using
Visual Studio 11, but it &lt;strong&gt;will also help you bridge towards
and share code with .NET 4.5 WPF, and to Metro style XAML
applications.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;Additional Information&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://www.microsoft.com/en-us/download/details.aspx?id=19957"&gt;
Download: Task-based Asynchronous Pattern&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/09/04/simplifying-async-networking-with-tasks-in-silverlight-5"&gt;
Simplifying Async Networking with Tasks in Silverlight 5&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2012/05/21/under-the-covers-of-the-async-modifier-and-await-operator-in-net-45-and-c-metro-style-applications"&gt;
Under the covers of the async modifier and await operator in .NET
4.5 and C# Metro style applications&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/j5enxX1Qm7XOxG6Kvfwpoq2-pj4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j5enxX1Qm7XOxG6Kvfwpoq2-pj4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/j5enxX1Qm7XOxG6Kvfwpoq2-pj4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/j5enxX1Qm7XOxG6Kvfwpoq2-pj4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/0VIFcIGRC_8" height="1" width="1"/&gt;</description></item><item><title>My new role at Microsoft</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/05/22/my-new-role-at-microsoft</link><pubDate>Tue, 22 May 2012 18:27:40 GMT</pubDate><guid>http://10rem.net/blog/2012/05/22/my-new-role-at-microsoft</guid><description>&lt;p&gt;This past Monday (May 14th), I officially started a new role at
Microsoft. I like to be as transparent as possible, so I thought
I'd share with you all the details of this role as well as where I
was before I moved to it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;XAML. Windows. Developers. 'nuf said.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;A little (optional) history&lt;/h3&gt;

&lt;p&gt;I've been working for Microsoft for a bit over two and a half
years now. In that time, I've learned that the old cliché about the
only constant being change is more true for Microsoft than just
about any other place I've seen. Mixing up teams, offices etc. from
time to time helps make the orgs more efficient, and injects new
ideas into groups.&lt;/p&gt;

&lt;p&gt;When I was hired by Scott Hanselman in fall 2009, my primary
focus was to create a lot of content for &lt;a
href="http://windowsclient.net/"
target="_blank"&gt;WindowsClient.net&lt;/a&gt; and &lt;a
href="http://silverlight.net/" target="_blank"&gt;Silverlight.net&lt;/a&gt;,
as well as my blog. In addition to Scott, the team I joined
included Tim Heuer, Rey Bango, Joe Stagner, Jesse Liberty and Jon
Galloway. A few months later, Tim Heuer fulfilled a personal dream
and moved to the one of the product teams. Ten months after I
joined, Scott moved to the Web team, and Rey Bango moved to another
org to focus on some initiatives that he had been leading. Some of
this was due to the reorg that created the brand new organization
(with all brand new leadership) my team was moved to.&lt;/p&gt;

&lt;p&gt;The people I worked with and for in that org were awesome. I've
enjoyed that role, and particularly enjoyed working closely with
patterns &amp;amp; practices, MSDN, and more.&lt;/p&gt;

&lt;p&gt;When Scott moved to the web team, I was given the lead of the
Community Team which by then included me, Jesse Liberty, Jon
Galloway, and Joe Stagner. We accomplished some really great
things, but at the same time, found ourselves focusing on tasks and
priorities which didn't quite fit the emerging mission, or in some
cases the capabilities, of our new org. Joe and Jesse moved on for
their own reasons, and are both now doing awesome stuff. Jon and I
stayed in the org, but a team of two is hard to keep effective and
impactful, despite excellent management support and an org full of
passionate and interesting people.&lt;/p&gt;

&lt;p&gt;Jon and I agreed that he should &lt;a
href="http://weblogs.asp.net/jgalloway/archive/2012/04/18/i-ve-joined-the-windows-azure-technical-evangelist-team.aspx"&gt;
pursue his interests and move to the Azure/Web evangelism team&lt;/a&gt;,
a move that really fit what he wanted to do, and does best.
&lt;strong&gt;Jon is an awesome guy, and I really enjoyed having him work
for me.&lt;/strong&gt; We continue to work together of course; the only
big change for us with his move is that I no longer need to approve
his expense reports (yay!). I was certainly able to stay where I
was, but once I was sure Jon was well-settled, and I no longer had
any direct reports, I was free to pursue something I was truly
excited about.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/85121/Windows-Live-Writer_2f4c22815519_14B7E_image_19.png" width="650" height="198" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;h3&gt;My interests and passions&lt;/h3&gt;

&lt;p&gt;I love working with XAML. Most of you have probably figured that
out. It's not my only interest by far, but it is a strong one. My
technical passions, in no particular order are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Client application development, primarily on Windows (I don't
own a Mac, and it's been around 12 years since I last ran a Linux
box)&lt;/li&gt;

&lt;li&gt;Open source hardware (and general maker / electronics / CNC /
3d Printing and more)&lt;/li&gt;

&lt;li&gt;Open source software&lt;/li&gt;

&lt;li&gt;User experience and (to my limited ability) graphics
design&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I especially enjoy writing and speaking about C# + XAML,
although I'm starting to dabble in C++ + XAML (say that out loud)
as well. I've always liked working with Silverlight and WPF, and
the communities of people building awesome stuff using them.
Lately, I've been working a lot more with Windows 8 as well. I'm
really excited about what I see coming for Windows, and for Windows
8 devices like tablets/slates. &lt;strong&gt;In fact, some time ago, I
committed to creating a Windows 8 XAML book with Manning (the first
MEAP chapters will be out very soon - promise!).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I enjoy building applications and gadgets. I also love
speaking to&lt;/strong&gt; &lt;strong&gt;developers, and wanted to speak more
at larger events.&lt;/strong&gt; I like helping to represent the product
teams at Microsoft, as I've done for Silverlight and WPF. I wanted
to join an org where I can work with the technologies I love, the
communities I know and respect, and one which would allow me to
continue the personal policies of &lt;strong&gt;honesty, openness,
transparency, clarity, and authenticity&lt;/strong&gt; that were so
important when working in Hanselman's (and later my) team.&lt;img src="http://10rem.net/media/85126/Windows-Live-Writer_2f4c22815519_14B7E_image_13.png" width="650" height="165" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;h3&gt;The new role&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;To that end, I've taken a very cool role working for &lt;a
href="https://twitter.com/gisardo" target="_blank"&gt;Giorgio
Sardo&lt;/a&gt; as a corporate Technical Evangelist on the Windows
Platform Evangelism team, focusing on XAML&lt;/strong&gt;. (This is the
current incarnation of the team John Papa was on and that Brian
Keller, Jaime Rodriguez, and Giorgio Sardo, among others, are
currently on.) I will continue to be a remote employee, working out
of my house near Annapolis, MD (between Baltimore, Washington and
the Chesapeake Bay). I will also continue working with the
Silverlight and WPF community, but will add to that a much larger
focus on Windows 8 XAML going forward, and possibly some phone work
too. &lt;strong&gt;Metro style apps have huge potential both short term
and long term in all areas of client development from consumers to
line of business. I want to be a part of their success, part of
your success.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Among the many things I'm going to try to accomplish are to help
find ways, &lt;strong&gt;for those who want to, to make it easier for
today's XAML developers to prepare for and migrate apps to WinRT
XAML if appropriate for their application&lt;/strong&gt;. &lt;em&gt;No forcing.
You use the technology that best meets your business and
application goals and requirements&lt;/em&gt;. I'll continue to do this
in a wide-reaching way through events, articles, toolkits, samples,
books, twitter, blogs and much more, and also add to that working
much more closely with people in the field, folks in the community,
and with some individual customers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;During my interviews, I made it very clear that I am a
horrible sales person.&lt;/strong&gt; Gladly, that's not this role. Some
community folks I speak with consider evangelism synonymous with
sales, but like so many roles at Microsoft, the role is really what
you make of it as an individual. The team I'm part of is full of
high-integrity individuals who all believe in the same things I do.
During the day of interviews, the ideas I proposed, ideas that I
believe many of you will find match with or support your own goals,
were received with enthusiasm and excitement.&lt;/p&gt;

&lt;p&gt;I'm really happy to continue with XAML, and to continue working
with the community, now with more Metro. My first task? Helping to
build a cool and relevant keynote demo. EXACTLY the type of thing
I've wanted to do for a long time :)&lt;/p&gt;

&lt;p&gt;In addition to that, last week I had VSLive NYC where I had
three sessions covering &lt;strong&gt;Silverlight, WPF, and Windows
8&lt;/strong&gt;, a Saturday code camp session in Philly on
&lt;strong&gt;Windows 8 XAML&lt;/strong&gt;, and coming up in June, a &lt;a
href="http://northamerica.msteched.com/topic/details/2012/DEV335"&gt;Tech
Ed session on WPF 4.5&lt;/a&gt;. Oh, and in August I'll be speaking at &lt;a
href="http://www.thatconference.com/"&gt;thatConference&lt;/a&gt; on
&lt;strong&gt;Windows 8 for Silverlight and WPF devs&lt;/strong&gt;, and also
on &lt;strong&gt;open source hardware&lt;/strong&gt;, and again at VSLive on
&lt;strong&gt;WPF and Windows 8 XAML&lt;/strong&gt;. You can see that I have
quite a mix there, with good representation from all the client
members of the XAML family.&lt;/p&gt;

&lt;p&gt;And, of course, I will &lt;strong&gt;continue with my NETMF and gadget
work&lt;/strong&gt;. That's always been as much a personal passion as
anything. I often find a way to work it in with my primary focus,
and will be doing that here for sure.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/85131/Windows-Live-Writer_2f4c22815519_14B7E_image_10.png" width="650" height="136" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;h3&gt;FAQ (or at least the Qs I think will be F)&lt;/h3&gt;

&lt;p&gt;Forgive me if any of these are pretentious. I've jut made a best
guess as to the questions you may have.&lt;/p&gt;

&lt;h4&gt;Q: Are you abandoning Silverlight / WPF?&lt;/h4&gt;

&lt;p&gt;A: Nope. Those technologies are just as important now as ever.
Silverlight 5 was an exciting and huge release. WPF 4.5 is an
equally interesting release. I &lt;strong&gt;will focus more on XAML in
general and Windows 8 in particular&lt;/strong&gt;, but I'm keeping my
fingers in all the pots. &lt;strong&gt;My Silverlight 5 book should be
back from the printers any day now&lt;/strong&gt;, so you can enjoy all
1000 printed pages (and 200-300 downloadable pages) as well. I also
have Silverlight and WPF sessions at upcoming conferences, and as
long as folks keep showing up to learn, and I have something new to
teach, I'll keep teaching.&lt;/p&gt;

&lt;h4&gt;Q: Are you going to focus exclusively on Windows 8 XAML&lt;/h4&gt;

&lt;p&gt;A: Not exclusively, but I will certainly focus more time and
energy in that area. It's new. It's exciting, and I think
&lt;strong&gt;it's going to be a big deal for every developer&lt;/strong&gt;.
See my list of events above for the current mix of sessions I'm
doing, for example.&lt;/p&gt;

&lt;h4&gt;Q: What about your NETMF/Gadgeteer Stuff?&lt;/h4&gt;

&lt;p&gt;A: I'll still work on that, as I really enjoy it. It was always
a hobby and will continue to be one. Also, I'm always looking for
ways to sneak it into other technology demos. :)&lt;/p&gt;

&lt;h4&gt;Q: What happened to your Silverlight 5 book?&lt;/h4&gt;

&lt;p&gt;A: I wrote WAY too much, so it took forever to edit and print.
It's out any day now. The delay is completely my fault.&lt;/p&gt;

&lt;h4&gt;Q: What is your next book?&lt;/h4&gt;

&lt;p&gt;A: Windows 8 XAML, of course. I've had this one in progress for
quite some time, but the burden of editing 1300 pages of my SL5
book caused a bit of a delay :). Expect to see the MEAP soon,
hopefully in time for our June Windows release. The next book will
be, by Manning's insistence,&amp;nbsp;much shorter but equally as
useful :)&lt;/p&gt;

&lt;h4&gt;Q: Are you moving to Redmond?&lt;/h4&gt;

&lt;p&gt;A: Nope. I am very proud to be the first remote worker in this
team at Microsoft. Working remotely sometimes limits the things you
can do at Microsoft, but I'm really glad this org not only looked
past that, but embraced it as a strength. &lt;strong&gt;Besides, working
on the east coast lets me be a nightowl at home, but still appear
to be a morning person to those in Redmond&lt;/strong&gt; ;)&lt;/p&gt;

&lt;h4&gt;Q: Why Windows 8 XAML as a primary focus?&lt;/h4&gt;

&lt;p&gt;A: I'm a super ADD person, just ask my wife. (Squirrel!!) I need
new and exciting things to keep me going. They also need to be new
things that &lt;strong&gt;I'm genuinely excited about&lt;/strong&gt;, and which
I think will be a &lt;strong&gt;benefit to the community of
developers&lt;/strong&gt;. Metro and WinRT + XAML + .NET 4.5 definitely
fits that criteria. &lt;strong&gt;I'm even excited about the HTML/JS side
of Windows 8 Metro, but I have close to zero skills there
currently.&lt;/strong&gt;&lt;/p&gt;

&lt;h4&gt;Q: Why the corporate/platform evangelism team?&lt;/h4&gt;

&lt;p&gt;A: This is the team that builds the customer connections,
creates the keynote demos, generally has earliest and best access
to cool stuff, and has a &lt;strong&gt;bunch of very cool people I
respect&lt;/strong&gt;. It also helps that they wanted me to join :)&lt;/p&gt;

&lt;h4&gt;Q: Will you continue to help run the Silverlight and WPF/Client
App Dev MVP programs&lt;/h4&gt;

&lt;p&gt;A: Yes, in the same capacity as today.&lt;/p&gt;

&lt;h4&gt;Q: Metro all the things?&lt;/h4&gt;

&lt;p&gt;YES :)&lt;/p&gt;

&lt;p&gt;&lt;a href="http://www.quickmeme.com/meme/35ogr3/"
target="_blank"&gt;&lt;img src="http://10rem.net/media/85136/Windows-Live-Writer_2f4c22815519_14B7E_image_3.png" width="322" height="239" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;(&lt;a href="http://www.flickr.com/photos/57933043@N00/6833646427/"
target="_blank"&gt;Robot minifig photo source&lt;/a&gt;.)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/9gBDJWMpOFMq2ueVTdfFtSxccGs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9gBDJWMpOFMq2ueVTdfFtSxccGs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/9gBDJWMpOFMq2ueVTdfFtSxccGs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/9gBDJWMpOFMq2ueVTdfFtSxccGs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/VFxiT0-YoGE" height="1" width="1"/&gt;</description></item><item><title>The correct AdventureWorks database to use for Silverlight 5 in Action (and Silverlight 4 in Action) book examples</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/05/21/the-correct-adventureworks-database-to-use-for-silverlight-5-in-action-and-silverlight-4-in-action-book-examples</link><pubDate>Tue, 22 May 2012 01:33:45 GMT</pubDate><guid>http://10rem.net/blog/2012/05/21/the-correct-adventureworks-database-to-use-for-silverlight-5-in-action-and-silverlight-4-in-action-book-examples</guid><description>&lt;p&gt;A reader tipped me off that the AdventureWorks schema has
changed since I (and my tech reviewers) last downloaded a copy.
Some of the schema changes make the database unworkable with the
in-book examples for Silverlight 4 in Action and &lt;a
href="http://manning.com/pbrown2/" target="_blank"&gt;Silverlight 5 in
Action&lt;/a&gt;. In particular, the Person table is no longer there in
recent versions.&lt;/p&gt;

&lt;p&gt;A version of the database that is compatible with the examples
in my Silverlight book can be found on this page:&lt;/p&gt;

&lt;p&gt;&lt;a
title="http://msftdbprodsamples.codeplex.com/releases/view/4004"
href="http://msftdbprodsamples.codeplex.com/releases/view/4004"&gt;http://msftdbprodsamples.codeplex.com/releases/view/4004&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The top download, AdventureWorksDB.msi is what you want. It's
dated May 7, 2007. It's maked as SQL Server 2005, but it works with
more recent version. A later version of the database may work
(pretty sure the one I used was dated 2009 or 2010), but this one
is the only currently available compatible version we can find.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Q7C6-rm65rseft9godPYU8CLY2c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q7C6-rm65rseft9godPYU8CLY2c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Q7C6-rm65rseft9godPYU8CLY2c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q7C6-rm65rseft9godPYU8CLY2c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/5BWt1QZtifU" height="1" width="1"/&gt;</description></item><item><title>Workaround for CA0055 Error with Silverlight Projects in Visual Studio 2010</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/04/17/workaround-for-ca0055-error-with-silverlight-projects-in-visual-studio-2010</link><pubDate>Tue, 17 Apr 2012 19:07:46 GMT</pubDate><guid>http://10rem.net/blog/2012/04/17/workaround-for-ca0055-error-with-silverlight-projects-in-visual-studio-2010</guid><description>&lt;p&gt;&lt;a
href="https://connect.microsoft.com/VisualStudio/feedback/details/713608/ca0055-silverlight5-business-application-project"&gt;
This connect bug&lt;/a&gt; describes an issue with creating certain types
of Silverlight projects in Visual Studio. If you're referencing
Silverlight 4 DLLs from a Silverlight 5 project, you may run into
this &lt;a
href="http://msdn.microsoft.com/en-us/library/y8hcsad3(v=vs.80).aspx"&gt;
code analysis/FXCop&lt;/a&gt; issue yourself if code analysis is part of
your process. The core of the problem is a versioning decision in
Silverlight 5 which results in compile-time violation due to
loading two different versions of mscorlib in the same project. It
manifests as the following error:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Error 2 CA0055 : Could not unify the platforms (mscorlib,
Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e,
mscorlib, Version=5.0.5.0, Culture=neutral,
PublicKeyToken=7cec85d7bea7798e) for
'MyProject.Silverlight\obj\Debug\MyProject.dll'.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More &lt;a
href="http://msdn.microsoft.com/en-us/library/ms244741.aspx"&gt;information
on CA0055 may be found on MSDN&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;How to Reproduce the Issue … in theory&lt;/h3&gt;

&lt;p&gt;In theory, all you need to do to reproduce the issue is
reference a SL4-targeted DLL from an SL5 application. However, in
practice, there are other factors in play. For example, it may
matter which mscorlib version gets loaded first.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;These steps won't repro the problem on my installation,
but I'm putting them out here in case they help you visualize the
issue (and also because I had already written them up when I
realized they don't repro here -- I don't want all these bits to go
to waste).&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Create a Silverlight 4 class library. Make sure you target
Silverlight 4. I named mine SL4ClassLibrary. The actual code is
unimportant, but I set it to the following:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
namespace SL4ClassLibrary&lt;br /&gt;
{&lt;br /&gt;
    public class Class1&lt;br /&gt;
    {&lt;br /&gt;
        public string Foo = "Bar";&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;Next, add a Silverlight 5 Application project. Make sure it
targets Silverlight 5. Here's what my solution looks like:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/84844/Windows-Live-Writer_3f6292c37abe_F3BC_image_2.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/84849/Windows-Live-Writer_3f6292c37abe_F3BC_image_thumb.png" width="308" height="335" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Build the solution.&lt;/p&gt;

&lt;p&gt;Next, add a File Reference (not a project reference) from the
Silverlight 5 client app to the Silverlight 4 DLL.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/84854/Windows-Live-Writer_3f6292c37abe_F3BC_image_4.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/84859/Windows-Live-Writer_3f6292c37abe_F3BC_image_thumb_1.png" width="500" height="269" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you build it now, everything works fine. The key step here is
to add code analysis. Many organizations have code analysis as a
required part of their build process, using the compiler
command-line arguments. If you don't, you can turn it on via the
menu:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/84864/Windows-Live-Writer_3f6292c37abe_F3BC_image_8.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/84869/Windows-Live-Writer_3f6292c37abe_F3BC_image_thumb_3.png" width="342" height="257" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then check the "Enable Code Analysis on Build" checkbox.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/84874/Windows-Live-Writer_3f6292c37abe_F3BC_image_6.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/84879/Windows-Live-Writer_3f6292c37abe_F3BC_image_thumb_2.png" width="500" height="339" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now build the solution. In theory, you'll get a CA0055 error,
but as I mentioned at the top, that doesn't happen on my install.
Most of the people who have reported this issue on the connect bug
have mentioned it in the context of the Business Application
Template or third party controls.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Remember, this is a code analysis compile/build issue,
not a runtime issue, so if you get past compiling your application,
you're good.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;The Workaround&lt;/h3&gt;

&lt;p&gt;This is already planned to be fixed in Visual Studio 11 RC.
However, we do have a manual workaround for this to help you
continue working if you're running into this scenario today. This
will unblock using FxCop in Visual Studio 2010.&lt;/p&gt;

&lt;p&gt;A high level walkthrough of how this works from the command line
is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We will tell FxCop which version of the runtime it will be
using by pointing it to Silverlight 5's installed mscorlib.dll
using the /platform argument&lt;/li&gt;

&lt;li&gt;Tell FxCop where to find all of the referenced assemblies using
/d (short for /directory) arguments: Use as many /d:&amp;lt;folder&amp;gt;
arguments as necessary for FxCop to find all of the referenced
assemblies.&lt;/li&gt;

&lt;li&gt;Use either /console to tell FxCop to output the results to the
console window, or /out:&amp;lt;file&amp;gt; to tell FxCop to write the
results to an .xml file&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To run FxCop from the command line for a default Business
Application:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the %Visual Studio Install Directory%\Team Tools\Static
Analysis\FxCop folder to PATH&lt;/li&gt;

&lt;li&gt;Run "fxcopcmd.exe /file:&amp;lt;SL Business Application binary&amp;gt;
/platform:&amp;lt;SL5 Reference Assemblies Directory\mscorlib.dll&amp;gt;
/d:&amp;lt;SL4 Reference Assemblies Directory&amp;gt; /d:&amp;lt;SL4 SDK Client
Libraries Directory&amp;gt;"&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;An example of what this looks like on an x64 operating system
with all of the default install directories is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SET PATH=%PATH%;C:\Program Files (x86)\Microsoft Visual Studio
10.0\Team Tools\Static Analysis Tools\FxCop&lt;/li&gt;

&lt;li&gt;fxcopcmd /file:BusinessApplication1.dll /platform:"C:\Program
Files (x86)\Reference
Assemblies\Microsoft\Framework\Silverlight\v5.0\mscorlib.dll"
/d:"C:\Program Files (x86)\Reference
Assemblies\Microsoft\Framework\Silverlight\v4.0" /d:"C:\Program
Files (x86)\Microsoft SDKs\Silverlight\v4.0\Libraries\Client"
/out:results.xml&lt;/li&gt;

&lt;li&gt;NOTE: If you receive a CA0001 error: "The following error was
encountered while reading module 'XXXX.YYYYY' : Assembly reference
cannot be resolved…" this means that you need to find where that
assembly is installed to on your machine and add an additional
/d:&amp;lt;installed directory&amp;gt; argument pointing FxCop to where
those assemblies are installed.&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;My thanks to the Silverlight Team and to Andrew Hall for the
information on this workaround.&lt;/p&gt;

&lt;p&gt;Of course, the easiest and best solution, if you can do it, is
to use libraries that specifically target Silverlight 5, and make
sure all references from your Silverlight 5 project are to
libraries targeting Silverlight 5.&amp;nbsp; We know that's not
possible in all cases, including the specific reported business
application case, which is why we documented this workaround.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7j0XQ_LOsYrspu8Y4DbHXs3BxzU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7j0XQ_LOsYrspu8Y4DbHXs3BxzU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7j0XQ_LOsYrspu8Y4DbHXs3BxzU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7j0XQ_LOsYrspu8Y4DbHXs3BxzU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/bU1_qm2GVuU" height="1" width="1"/&gt;</description></item><item><title>Released: New Version of Expression Blend for Silverlight 5</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/03/29/released-new-version-of-expression-blend-for-silverlight-5</link><pubDate>Thu, 29 Mar 2012 18:32:38 GMT</pubDate><guid>http://10rem.net/blog/2012/03/29/released-new-version-of-expression-blend-for-silverlight-5</guid><description>&lt;p&gt;You may have noticed that your current copy of Expression Blend
for Silverlight 5 expires in the next day or two. A new version of
Expression Blend Preview for Silverlight 5 is now out. &lt;a
href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=9503"
 target="_blank"&gt;Get it here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This new version has the all important go-live license, and also
extends the expiration date to June 20, 2013 (over a year from
now)..&lt;/p&gt;

&lt;p&gt;More information on the &lt;a
href="http://blendinsider.com/version-expression-blend-4/updated-microsoft-expression-blend-preview-for-silverlight-5-2012-03-29/"
 target="_blank"&gt;Expression Blend Team Blog&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/x0y0giz_t68kixH6I25uTDAGNLA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/x0y0giz_t68kixH6I25uTDAGNLA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/x0y0giz_t68kixH6I25uTDAGNLA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/x0y0giz_t68kixH6I25uTDAGNLA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/nE75v_H25WI" height="1" width="1"/&gt;</description></item><item><title>XAML Tip: Setting Attached Properties from Code</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/03/29/xaml-tip-setting-attached-properties-from-code</link><pubDate>Thu, 29 Mar 2012 17:36:39 GMT</pubDate><guid>http://10rem.net/blog/2012/03/29/xaml-tip-setting-attached-properties-from-code</guid><description>&lt;p&gt;Recently, &lt;a
href="http://10rem.net/blog/2011/09/02/silverlight-5-and-wpf-4-opentype-support#comments"
 target="_blank"&gt;a reader asked&lt;/a&gt; how they should go about
setting the Typography properties from code-behind.&lt;/p&gt;

&lt;p&gt;The original question was about Silverlight, but the approach
works in WPF, Windows 8 and more.&lt;/p&gt;

&lt;p&gt;Given the following markup:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;StackPanel&amp;gt;&lt;br /&gt;
    &amp;lt;TextBlock x:Name="OriginalText"&lt;br /&gt;
               FontSize="72"&lt;br /&gt;
               FontFamily="Gabriola"&lt;br /&gt;
               Text="Hello World!" /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;TextBlock x:Name="ExampleText"&lt;br /&gt;
               FontSize="72"&lt;br /&gt;
               FontFamily="Gabriola"&lt;br /&gt;
               Text="Hello World!" /&amp;gt;&lt;br /&gt;
&amp;lt;/StackPanel&amp;gt;&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;You can set an &lt;a
href="http://msdn.microsoft.com/en-us/library/ms749011.aspx"
target="_blank"&gt;attached property&lt;/a&gt; such as
&lt;strong&gt;Typography.StylisticSet5&lt;/strong&gt; by using the
&lt;strong&gt;SetValue&lt;/strong&gt; method like this:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void SetTextOptions()&lt;br /&gt;
{&lt;br /&gt;
    ExampleText.SetValue(Typography.StylisticSet5Property, true);&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The &lt;strong&gt;SetValue&lt;/strong&gt; method comes from the
&lt;strong&gt;DependencyObject&lt;/strong&gt; base class.
&lt;strong&gt;Typography.StylisticSet5Property&lt;/strong&gt; is the name of a
dependency property - an attached property in this case. This could
easily have been the &lt;strong&gt;Canvas.Left&lt;/strong&gt; property, the
&lt;strong&gt;Grid.Row&lt;/strong&gt; property or any number of other attached
properties. The resulting display looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/84198/Windows-Live-Writer_XAML-Tip-Setting-Attached-Properties-fro_BBAD_image_2.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/84203/Windows-Live-Writer_XAML-Tip-Setting-Attached-Properties-fro_BBAD_image_thumb.png" width="257" height="166" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Note how the second TextBlock has had the stylistic set applied
to it.&lt;/p&gt;

&lt;p&gt;This approach used the &lt;strong&gt;SetValue&lt;/strong&gt; method of the
dependency object. There's also another way:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void SetTextOptions()&lt;br /&gt;
{&lt;br /&gt;
    Typography.SetStylisticSet5(ExampleText, true);&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;This version uses the &lt;strong&gt;Set[dpname]&lt;/strong&gt; method of the
class which owns the property. Use the most convenient method. Both
are equivalent.&lt;/p&gt;

&lt;p&gt;I also cover dependency properties and attached properties in
both of my &lt;a href="http://manning.com/pbrown2/"
target="_blank"&gt;Silverlight books&lt;/a&gt;, as well as in my upcoming
Windows 8 XAML book.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dy73cfO371nscvM4Pj68-Oanu6c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dy73cfO371nscvM4Pj68-Oanu6c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dy73cfO371nscvM4Pj68-Oanu6c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dy73cfO371nscvM4Pj68-Oanu6c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/ZVum9U8aOzI" height="1" width="1"/&gt;</description></item><item><title>Tip: Binding an Image element’s Source property to a Uri in WinRT XAML</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/03/27/tip-binding-an-image-elements-source-property-to-a-uri-in-winrt-xaml</link><pubDate>Tue, 27 Mar 2012 19:00:23 GMT</pubDate><guid>http://10rem.net/blog/2012/03/27/tip-binding-an-image-elements-source-property-to-a-uri-in-winrt-xaml</guid><description>&lt;p&gt;Over the years, I've conditioned myself to use the Uri class
when surfacing web URLs in my application. Early versions of
Silverlight couldn't bind an image source directly to an instance
of a Uri because they lacked an appropriate type converter; the
usual workaround was to change the property to a string type.&lt;/p&gt;

&lt;p&gt;Subsequent versions Silverlight added that capability and the
converter. For example. Given an instance of the following model
class as the data context:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
public class Tweet&lt;br /&gt;
{&lt;br /&gt;
    public string Message { get; set; }&lt;br /&gt;
    public Uri Image { get; set; }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;In Silverlight, you can bind in XAML like this:&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&lt;br /&gt;
&amp;lt;Image Source="{Binding Image}" /&amp;gt;&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;In the current version of Windows 8/WinRT XAML, you can't bind
image sources directly to Uris, but there's a nice way to do it by
using property element syntax and and a BitmapImage class. It's
more verbose, but may be just the ticket if you need to bind to
Uris and not strings, and can't change, or don't want to change,
your [view]model.&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;Image&amp;gt;&lt;br /&gt;
    &amp;lt;Image.Source&amp;gt;&lt;br /&gt;
        &amp;lt;BitmapImage UriSource="{Binding Image}" /&amp;gt;&lt;br /&gt;
    &amp;lt;/Image.Source&amp;gt;&lt;br /&gt;
&amp;lt;/Image&amp;gt;&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;The team is aware of this difference, and have it in their
backlog of things to prioritize for future revs. In case you're
sharing markup or anything between WinRT XAML and Silverlight, it's
good to know this more verbose approach works in both.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_mku3Emzu_MMYk2zznjAK2lFEWI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_mku3Emzu_MMYk2zznjAK2lFEWI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_mku3Emzu_MMYk2zznjAK2lFEWI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_mku3Emzu_MMYk2zznjAK2lFEWI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/us6EQfybP4s" height="1" width="1"/&gt;</description></item><item><title>Getting Started with XAML: Slides and demos</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/02/26/getting-started-with-xaml-slides-and-demos</link><pubDate>Mon, 27 Feb 2012 00:22:17 GMT</pubDate><guid>http://10rem.net/blog/2012/02/26/getting-started-with-xaml-slides-and-demos</guid><description>&lt;p&gt;At the South Florida Code Camp last week, I gave an early
morning talk titled "Getting Started with XAML". In this talk, I
covered the basics of XAML, the property system, layout, and other
things you need to know as a XAML developer for WPF, Silverlight,
or Windows 8.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/83828/Windows-Live-Writer_ff6b33035bc2_11C5E_image_3.png" width="644" height="363" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;h3&gt;Slides&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Attached to this post&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Demos&lt;/h3&gt;

&lt;p&gt;It was all real-time stuff in this talk. No downloadable demos.
I encourage you to use the Getting Started content on MSDN:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/ff728590"&gt;Build your
first Silverlight web application&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/ff728576"&gt;Build your
first desktop RIA application with Silverlight&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Both include downloadable code in both C# and Visual Basic.&lt;/p&gt;

&lt;h3&gt;My Silverlight Book&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://manning.com/pbrown2/"&gt;Silverlight 5 in
Action&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;I also have a Windows 8 XAML book in progress. More on that
when it gets closer to publication&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Related Links&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.silverlight.net/"&gt;Home:
Silverlight.NET&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/windows"&gt;Windows Dev
Center&lt;/a&gt; (for Windows 8 Metro XAML)&lt;/li&gt;

&lt;li&gt;&lt;a href="http://windowsclient.net/"&gt;The Official Microsoft WPF
and Windows Forms Site&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_8GG38DditzRVozbXVc-Sm4L24s/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_8GG38DditzRVozbXVc-Sm4L24s/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_8GG38DditzRVozbXVc-Sm4L24s/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_8GG38DditzRVozbXVc-Sm4L24s/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/tj9ukG9Fogg" height="1" width="1"/&gt;</description></item><item><title>REST with Silverlight 5, ASP.NET Web API, and MVC 4 Beta</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/02/26/rest-with-silverlight-5-aspnet-web-api-and-mvc-4-beta</link><pubDate>Sun, 26 Feb 2012 23:50:21 GMT</pubDate><guid>http://10rem.net/blog/2012/02/26/rest-with-silverlight-5-aspnet-web-api-and-mvc-4-beta</guid><description>&lt;p&gt;At the South Florida Code Camp I gave a newer version of the
REST Silverlight talk using the just released MVC 4 Beta and
ASP.NET Web API.&lt;/p&gt;

&lt;p&gt;This talk shows how to share code between different versions of
the framework, how to use the ASP.NET Web API from Silverlight, and
how to integrate a Silverlight application into an MVC 4 site.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/83782/Windows-Live-Writer_REST-with-Silverlight-5_1133C_image_thumb.png" width="644" height="364" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;h3&gt;Powerpoint Slides&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Attached to this post&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Demos and Examples&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Download the &lt;a href="http://10rem.net/pub/demos/MVC4Beta_REST_SL5_Demo.zip"
target="_blank"&gt;full source and my demo snippit text file
here&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;My Book&lt;/h3&gt;

&lt;p&gt;I cover this in my Silverlight 5 book. At the time of this
writing, the MEAP has the MVC3 version. I'll update it for the
print and ebook shortly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://manning.com/pbrown2/"&gt;Silverlight 5 in
Action&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Related Links&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://weblogs.asp.net/jgalloway/archive/2012/02/16/asp-net-4-beta-released.aspx"&gt;
ASP.NET MVC 4 Beta Released! - Jon Galloway&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://www.asp.net/web-api"&gt;Web API: The Official
Microsoft ASP.NET Site&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/08/01/creating-a-silverlight-5-helper-for-aspnet-mvc3-razor"&gt;
Creating a Silverlight 5 Helper for ASP.NET MVC3 Razor&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.hanselman.com/blog/OneASPNETMakingJSONWebAPIsWithASPNETMVC4BetaAndASPNETWebAPI.aspx"&gt;
One ASP.NET - Making JSON Web APIs with ASP.NET MVC 4 Beta and
ASP.NET Web API - Scott Hanselman&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://wcf.codeplex.com/"&gt;WCF Community Site&lt;/a&gt; (for
older WCF version)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Previous Versions&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/12/15/slides-and-code-from-my-vslive-silverlight-5-rest-wcf-web-api-mvc-talk"&gt;
Slides and Code from my VSLive Silverlight 5, REST, WCF Web API,
MVC talk&lt;/a&gt; (MVC 3 version)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/IqUlHUyGrHiQg_dsqZArCqQZRqI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IqUlHUyGrHiQg_dsqZArCqQZRqI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/IqUlHUyGrHiQg_dsqZArCqQZRqI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/IqUlHUyGrHiQg_dsqZArCqQZRqI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/4-kercvO9Gg" height="1" width="1"/&gt;</description></item><item><title>A Lap Around Silverlight 5: Slides and Code</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/02/26/a-lap-around-silverlight-5-slides-and-code</link><pubDate>Sun, 26 Feb 2012 23:30:47 GMT</pubDate><guid>http://10rem.net/blog/2012/02/26/a-lap-around-silverlight-5-slides-and-code</guid><description>&lt;p&gt;At the South Florida Code Camp, I gave the "Lap Around
Silverlight 5" talk. The slides and code are all available via the
links below.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/83760/Windows-Live-Writer_65e267c6fe8f_F85C_image_3.png" width="644" height="364" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;h3&gt;Powerpoint Slides&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Attached to this post&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Demos and Examples&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/09/04/the-big-list-of-whats-new-or-improved-in-silverlight-5"&gt;
The Big List of What's New or Improved in Silverlight 5 - Pete
Brown's 10rem.net&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2012/01/10/threading-considerations-for-binding-and-change-notification-in-silverlight-5"&gt;
Threading Considerations for Binding and Change Notification in
Silverlight 5&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2012/02/07/creating-big-silverlight-windows-and-getting-monitor-resolutions-and-positions-with-pinvoke"&gt;
Creating Big Silverlight Windows and Getting Monitor Resolutions
and Positions with PInvoke&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-using-the-soundeffect-class-for-low-latency-sound-and-play-wav-files-in-silverlight"&gt;
Silverlight 5: Using the SoundEffect Class for Low-Latency Sound
(and play WAV files in Silverlight)&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-working-with-operating-system-windows"&gt;
Silverlight 5: Working with Operating System Windows&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-working-with-implicit-templates"&gt;
Silverlight 5: Working with Implicit Templates&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-debugging-bindings-with-xaml-breakpoints"&gt;
Silverlight 5: Debugging Bindings with Xaml Breakpoints&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-supporting-double-and-even-triple-click-for-the-mouse"&gt;
Silverlight 5: Supporting Double and Even Triple Click for the
Mouse&lt;/a&gt;&lt;/li&gt;

&lt;li style="list-style: none"&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/25/supporting-both-double-and-triple-click-in-silverlight-5"&gt;
Supporting both Double and Triple Click in Silverlight 5&lt;/a&gt;
(article with the timer approach)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-advancements-in-text"&gt;Silverlight
5: Advancements in Text&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;My Book&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://manning.com/pbrown2/"
target="_blank"&gt;Silverlight 5 in Action&lt;/a&gt;&lt;!--EndFragment--&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Downloads&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://code.msdn.microsoft.com/3D-Housebuilder-demo-from-def4af04"&gt;
Download the 3D House Builder Demo Application&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a href="http://babylontoolkit.codeplex.com/"&gt;See the Babylon
3d Engine on CodePlex&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Related Links&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://www.silverlight.net/getstarted/silverlight-5-beta/"&gt;Silverlight
5 Page on Silverlight.net&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/announcing-the-silverlight-5-beta-release-and-the-silverlightnet-redesign"&gt;
Announcing the Silverlight 5 Beta Release and the Silverlight.net
Redesign&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Previous Versions&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/05/23/slides-videos-and-downloads-from-my-tech-ed-atlanta-2011-and-recent-user-group-talks"&gt;
Slides, Videos, and Downloads from my Tech Ed Atlanta 2011 and
Recent User Group Talks&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/10/25/updated-slides-and-demos-from-vslive-redmond-2011"&gt;
Updated Slides and Demos from VSLive Redmond 2011&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HXjsX95u4E6SfJJWjxfRBbnWFis/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HXjsX95u4E6SfJJWjxfRBbnWFis/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HXjsX95u4E6SfJJWjxfRBbnWFis/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HXjsX95u4E6SfJJWjxfRBbnWFis/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/9UUyuOT5uD0" height="1" width="1"/&gt;</description></item><item><title>Windows Client Developer Roundup 087 for 2/9/2012</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/02/08/windows-client-developer-roundup-087-for-2-9-2012</link><pubDate>Thu, 09 Feb 2012 02:44:11 GMT</pubDate><guid>http://10rem.net/blog/2012/02/08/windows-client-developer-roundup-087-for-2-9-2012</guid><description>&lt;p&gt;The Windows Client Developer Roundup aggregates information of
interest to Windows Client Developers, including &lt;a
href="http://dev.windows.com/"&gt;WinRT XAML&lt;/a&gt;, &lt;a
href="http://windowsclient.net/"&gt;WPF&lt;/a&gt;, &lt;a
href="http://silverlight.net/"&gt;Silverlight&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/visualc/default.aspx"&gt;Visual
C++&lt;/a&gt;, &lt;a href="http://creators.xna.com/"&gt;XNA&lt;/a&gt;, &lt;a
href="http://expression.microsoft.com/"&gt;Expression Blend&lt;/a&gt;, &lt;a
href="http://www.microsoft.com/surface/"&gt;Surface&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/windows/default.aspx"&gt;Windows
7&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/ff380145.aspx"&gt;Windows
Phone&lt;/a&gt;, Visual Studio, &lt;a
href="http://silverlight.net/riaservices/"&gt;WCF RIA Services&lt;/a&gt; and
more. Sometimes I even include a little jQuery and HTML5. If you
have something interesting you've done or have run across, or you
blog regularly on the topics included here, please send me the URL
and brief description via the &lt;a href="http://10rem.net/contact"&gt;contact
link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note that I've started breaking the Netduino, Electronics,
Robotics, Synthesizer and similar content into a new roundup series
called the &lt;a href="http://10rem.net/blog?filterby=MakerRoundup"&gt;Maker Geek
Roundup&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Oh and you'll get Windows 8 Consumer Preview on February
29. Get ready to code (and&lt;/strong&gt; &lt;a
href="http://10rem.net/blog/2012/01/25/now-more-than-ever-you-need-a-designer"&gt;
&lt;strong&gt;design&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;) :)&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;Windows 8 and WinRT/Metro General&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/b8/archive/2012/02/07/improving-power-efficiency-for-applications.aspx"&gt;
Improving power efficiency for applications&lt;/a&gt; (Sharif Farag and
Ben Srour)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;XAML Technologies (Silverlight, WPF, WinRT Metro XAML)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://grokys.blogspot.com/2012/02/mvvm-and-multiple-selection-part-iv.html"&gt;
Bad Entropy: MVVM and Multiple Selection - Part IV - DataGrid&lt;/a&gt;
(Bad Entropy)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.sharpgis.net/post/2012/01/23/Overwriting-the-default-WebRequest-used-by-WebClient.aspx"&gt;
Overwriting the default WebRequest used by WebClient&lt;/a&gt; (Morten
Nielsen)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.sharpgis.net/post/2012/01/17/Building-A-Multi-Touch-Photo-Viewer-Control.aspx"&gt;
Building A Multi-Touch Photo Viewer Control&lt;/a&gt; (Morten
Nielsen)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.abhisheksur.com/2012/02/optimizing-inpc-objects-against-memory.html"&gt;
DOT NET TRICKS: Optimizing INPC Objects against memory leaks using
WeakEvents&lt;/a&gt; (Abhishek Sur)&lt;/li&gt;

&lt;li style="list-style: none"&gt;
&lt;ul&gt;
&lt;li&gt;Also see &lt;a
href="http://10rem.net/blog/2012/02/01/event-handler-memory-leaks-unwiring-events-and-the-weakeventmanager-in-wpf-45"&gt;
my post on weak events.&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://michaelcrump.net/using-the-live-sdk-in-windows-8-xaml/c-metro-applications"&gt;
Using the Live SDK in Windows 8 XAML/C# Metro Applications -
Michael Crump&lt;/a&gt; (Michael Crump)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.sharpgis.net/post/2012/01/12/Reading-and-Writing-text-files-in-Windows-8-Metro.aspx"&gt;
Reading and Writing text files in Windows 8 Metro&lt;/a&gt; (Morten
Nielsen)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.scottlogic.co.uk/blog/colin/2012/02/a-simple-pattern-for-creating-re-useable-usercontrols-in-wpf-silverlight/"&gt;
A Simple Pattern for Creating Re-useable UserControls in WPF /
Silverlight&lt;/a&gt; (Colin Eberhardt)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;DirectX Technologies (DirectX, XNA, WinRT DirectX, GPU and Game
Programming)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://xna-uk.net/blogs/darkgenesis/archive/2012/01/20/the-starter2d-and-starter3d-tutorials-now-on-the-marketplace.aspx"&gt;
The Starter2D and Starter3D tutorials now on the Marketplace&lt;/a&gt;
(Dark Genesis)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://channel9.msdn.com/coding4fun/blog/Large-Scale-Terrain-Rendering"&gt;
Large Scale Terrain Rendering&lt;/a&gt; (Coding4Fun)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;C++ and Native Development&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://geekswithblogs.net/mikebmcl/archive/2012/02/02/c-to-c-ndash-a-somewhat-short-guide.aspx"&gt;
C# to C++ - A Somewhat Short Guide&lt;/a&gt; (Bob Taco Industries)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2012/02/02/10263304.aspx"&gt;
C++11 Conformance Survey&lt;/a&gt; (Vikas Bhatia)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2012/02/03/10263262.aspx"&gt;
The Microsoft C++ Compiler Turns 20!&lt;/a&gt; (Visual C++ Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/somasegar/archive/2012/02/03/c-amp-open-specification.aspx"&gt;
C++ AMP Open Specification&lt;/a&gt; (Soma)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://channel9.msdn.com/posts/Announcing-the-GoingNative-2012-Full-Schedule"&gt;
GoingNative 2012: All Sessions are now available On-Demand!&lt;/a&gt;
(Channel 9)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Visual Studio and .NET General&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/visualstudio/archive/2012/01/18/announcing-visual-studio-achievements.aspx"&gt;
Bring Some Game To Your Code!&lt;/a&gt; (Visual Studio Blog)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;NUI (Kinect, Surface, More)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://robrelyea.wordpress.com/2012/02/01/k4w-details-of-api-changes-from-beta2-to-v1-managed/"&gt;
Kinect for Windows - Details of API Changes from Beta2 to v1.0
(C#/VB)&lt;/a&gt; (Rob Relyea)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/surface/archive/2012/02/05/microsoft-surface-2-sdk-and-runtime-update.aspx"&gt;
Microsoft® Surface® 2.0 SDK and Runtime Update&lt;/a&gt; (Luis
Cabrera)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://kinecthacks.net/interactive-portfolio/"&gt;Interactive
Portfolio&lt;/a&gt; (Kinect Hacks)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Off-Topic Fun&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.youtube.com/watch?v=LJSZ1TwjcsQ"&gt;The Karate
Rap&lt;/a&gt; (YouTube)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I leave you with only the one "off-topic" item today, because
after watching that, nothing else will ever suffice. Ever.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2W3Bv21FrL_E04Ujrigt7DqRflg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2W3Bv21FrL_E04Ujrigt7DqRflg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/2W3Bv21FrL_E04Ujrigt7DqRflg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2W3Bv21FrL_E04Ujrigt7DqRflg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/F41cjYACnZ8" height="1" width="1"/&gt;</description></item><item><title>Creating Big Silverlight Windows and Getting Monitor Resolutions and Positions with PInvoke</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/02/07/creating-big-silverlight-windows-and-getting-monitor-resolutions-and-positions-with-pinvoke</link><pubDate>Wed, 08 Feb 2012 03:59:11 GMT</pubDate><guid>http://10rem.net/blog/2012/02/07/creating-big-silverlight-windows-and-getting-monitor-resolutions-and-positions-with-pinvoke</guid><description>&lt;p&gt;While doing the (long!) tech review for Silverlight 5 in Action,
my friend and former coworker &lt;a
href="http://codemares.blogspot.com/"&gt;Tom McKearney&lt;/a&gt; mentioned
that we should put together some code to make handling windows
across multiple monitors a reasonable task in Silverlight 5. Then,
on a mailing list, I recently saw the question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hi all -- I'm wondering if there is a maximum window size for
Silverlight documented anywhere. For example if I had hardware that
could support a 3x3 or 3x4 grid of 1920x1080 displays, can I make
an SL5 OOB window that big? Can I make individual items in the
window that big? Can I get hardware acceleration on all of it? Does
the 3D API have any different limits than XAML? Or maybe
Silverlight has no specific limit, but it's up to the hardware?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Curious about that, I decided to try it myself, and combine this
with what Tom had requested. I don't have a 3x3 array of screens
that size, however. It really is a serious number of pixels.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83370/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_2.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83375/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb.png" width="650" height="234" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Cost of screens aside, most people don't have the video hardware
to be able to run 6 displays. ATI has some displayport cards which
will do that, but otherwise you're looking at a minimum of three
video cards and a variety of connections. You're also looking at a
shedload of video memory.&lt;/p&gt;

&lt;p&gt;What I do have is a pair of 30" displays each running at
2560x1600. That's quite a bit smaller, but still much larger than
most people have. It ends up being a bit less than half the
requested pixels. I do get almost the right width, but the height
is lacking.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83380/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_4.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83385/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb_1.png" width="650" height="142" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I wouldn't want 3x3 of the HD res screens (too much bevel)
unless they were big old TV-style ones and you were doing
relatively low-res graphics. 3x3 of the 2560x1600 though?
*drool*&lt;/p&gt;

&lt;p&gt;In any case, my two combined are still quite a bit larger than
the typical HD res 1920x1080 screen people have, with its 2,073,600
pixels, and is a valid test of creating big windows in
Silverlight.&lt;/p&gt;

&lt;p&gt;My displays are also oriented a little differently than you may
expect:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83390/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_6.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83395/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb_2.png" width="500" height="326" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That means that logical 0,0 is in the middle of the combined
display. We'll need to know that for later.&lt;/p&gt;

&lt;h3&gt;Creating the Window&lt;/h3&gt;

&lt;p&gt;If you want to learn how to create out-of-browser windows in
Silverlight 5, &lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-working-with-operating-system-windows"&gt;
see my post here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The first test is to see if I can create a window that fits the
dimensions of my two screens. All sizes here will be
hard-coded.&lt;/p&gt;

&lt;p&gt;XAML&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;UserControl x:Class="PeteBrown.SilverlightBigWindow.MainPage"&lt;br /&gt;
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br /&gt;
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"&lt;br /&gt;
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"&lt;br /&gt;
    mc:Ignorable="d"&lt;br /&gt;
    d:DesignHeight="175&lt;br /&gt;
             " d:DesignWidth="800"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Grid x:Name="LayoutRoot" Background="White"&amp;gt;&lt;br /&gt;
        &amp;lt;ListBox x:Name="DisplayList"&lt;br /&gt;
                 Margin="126,12,12,12"&amp;gt;&lt;br /&gt;
            &amp;lt;ListBox.ItemTemplate&amp;gt;&lt;br /&gt;
                &amp;lt;DataTemplate&amp;gt;&lt;br /&gt;
                    &amp;lt;Grid&amp;gt;&lt;br /&gt;
                        &amp;lt;Grid.ColumnDefinitions&amp;gt;&lt;br /&gt;
                            &amp;lt;ColumnDefinition Width="150" /&amp;gt;&lt;br /&gt;
                            &amp;lt;ColumnDefinition Width="50" /&amp;gt;&lt;br /&gt;
                            &amp;lt;ColumnDefinition Width="150" /&amp;gt;&lt;br /&gt;
                            &amp;lt;ColumnDefinition Width="150" /&amp;gt;&lt;br /&gt;
                            &amp;lt;ColumnDefinition Width="75" /&amp;gt;&lt;br /&gt;
                            &amp;lt;ColumnDefinition Width="75" /&amp;gt;&lt;br /&gt;
                        &amp;lt;/Grid.ColumnDefinitions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                        &amp;lt;TextBlock Grid.Column="0"&lt;br /&gt;
                                   Text="{Binding MonitorName}" /&amp;gt;&lt;br /&gt;
                        &amp;lt;TextBlock Grid.Column="1"&lt;br /&gt;
                                   Text="{Binding IsPrimary}" /&amp;gt;&lt;br /&gt;
                        &amp;lt;TextBlock Grid.Column="2"&lt;br /&gt;
                                   Text="{Binding MonitorArea}" /&amp;gt;&lt;br /&gt;
                        &amp;lt;TextBlock Grid.Column="3"&lt;br /&gt;
                                   Text="{Binding WorkArea}" /&amp;gt;&lt;br /&gt;
                        &amp;lt;TextBlock Grid.Column="4"&lt;br /&gt;
                                   Text="{Binding Width}" /&amp;gt;&lt;br /&gt;
                        &amp;lt;TextBlock Grid.Column="5"&lt;br /&gt;
                                   Text="{Binding Height}" /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
                    &amp;lt;/Grid&amp;gt;&lt;br /&gt;
                &amp;lt;/DataTemplate&amp;gt;&lt;br /&gt;
            &amp;lt;/ListBox.ItemTemplate&amp;gt;&lt;br /&gt;
        &amp;lt;/ListBox&amp;gt;&lt;br /&gt;
     &lt;br /&gt;
     &lt;br /&gt;
        &amp;lt;Button Content="Open Full"&lt;br /&gt;
                Height="23"&lt;br /&gt;
                HorizontalAlignment="Left"&lt;br /&gt;
                Margin="12,12,0,0"&lt;br /&gt;
                Name="OpenWindow"&lt;br /&gt;
                VerticalAlignment="Top"&lt;br /&gt;
                Width="108"&lt;br /&gt;
                Click="OpenWindow_Click" /&amp;gt;&lt;br /&gt;
        &amp;lt;Button Content="Open Primary"&lt;br /&gt;
                Height="23"&lt;br /&gt;
                HorizontalAlignment="Left"&lt;br /&gt;
                Margin="12,41,0,0"&lt;br /&gt;
                Name="OpenPrimary"&lt;br /&gt;
                VerticalAlignment="Top"&lt;br /&gt;
                Width="108"&lt;br /&gt;
                Click="OpenPrimary_Click" /&amp;gt;&lt;br /&gt;
        &amp;lt;Button Content="Open Secondary"&lt;br /&gt;
                Height="23"&lt;br /&gt;
                HorizontalAlignment="Left"&lt;br /&gt;
                Margin="12,70,0,0"&lt;br /&gt;
                Name="OpenSecondary"&lt;br /&gt;
                VerticalAlignment="Top"&lt;br /&gt;
                Width="108"&lt;br /&gt;
                Click="OpenSecondary_Click" /&amp;gt;&lt;br /&gt;
    &amp;lt;/Grid&amp;gt;&lt;br /&gt;
&amp;lt;/UserControl&amp;gt;&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;C# code&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void OpenWindow_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
    w.Width = 5120;&lt;br /&gt;
    w.Height = 1600;&lt;br /&gt;
&lt;br /&gt;
    w.Show();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void OpenPrimary_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void OpenSecondary_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;This will allow me to click a button and have it open a giant
window on the screen. The window has no content, so it'll appear as
a plain white empty window.&lt;/p&gt;

&lt;p&gt;Run it (remember, must be elevated trust out-of-browser app) and
what do you see? No problem. One giant white window which fits
across my screen.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83400/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_8.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83405/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb_3.png" width="650" height="203" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The problem is, however, that it starts in the middle of my
displays instead of over at the far left. I had to drag it to the
far left to get it to take up the whole set of displays. How do we
figure out how to position and size the window?&lt;/p&gt;

&lt;h3&gt;Positioning and Sizing the Window&lt;/h3&gt;

&lt;p&gt;On my setup, the monitor to the left is all in negative space.
So, to move the window to the far left, I need to move it to -2560.
Then we can open the window and then tell it to move to the top
left, or to take up just a single display.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void OpenWindow_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
    w.Width = 5120;&lt;br /&gt;
    w.Height = 1600;&lt;br /&gt;
&lt;br /&gt;
    w.Left = -2560;&lt;br /&gt;
    w.Top = 0;&lt;br /&gt;
    w.Show();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void OpenPrimary_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
    w.Width = 2560;&lt;br /&gt;
    w.Height = 1600;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    w.Left = 0;&lt;br /&gt;
    w.Top = 0;&lt;br /&gt;
    w.Show();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void OpenSecondary_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
    w.Width = 2560;&lt;br /&gt;
    w.Height = 1600;&lt;br /&gt;
&lt;br /&gt;
    w.WindowStyle = WindowStyle.None;&lt;br /&gt;
&lt;br /&gt;
    w.WindowState = WindowState.Maximized;&lt;br /&gt;
&lt;br /&gt;
    w.Left = -2560;&lt;br /&gt;
    w.Top = 0;&lt;br /&gt;
    w.Show();&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Ok, so we've verified that it can be done. Now we need to make
it work for arbitrary resolutions and monitor configurations.
&lt;strong&gt;Before we do that, though, did you notice that the sizing
was off a bit?&lt;/strong&gt; Both the width and height appear to be off
by the measurements of the window chrome. It turns out this happens
whether or not you're using custom chrome. &lt;strong&gt;I've reported a
bug to the team and they're investigating&lt;/strong&gt;, so for now
we're going to have to ignore the size issues. &lt;strong&gt;If you work
around the sizing in your own code, stick it in an conditional
compilation block&lt;/strong&gt; or something so you can easily change it
if/when the bug is fixed.&lt;/p&gt;

&lt;h3&gt;Getting Display Informatin Using PInvoke&lt;/h3&gt;

&lt;p&gt;We're running in elevated OOB mode anyway, so as long as you
only care about Windows, you can also throw in some P/Invoke. The
main functions we're interested in are &lt;a
href="http://pinvoke.net/default.aspx/user32.EnumDisplayMonitors"&gt;EnumDisplayMonitors&lt;/a&gt;
and &lt;a
href="http://msdn.microsoft.com/en-us/library/dd144901(v=VS.85).aspx"&gt;
GetMonitorInfo&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;The PInvoke.net example was enough to get me started, but it
lacked a few necessary steps. Of course, it also needed some
changes to work with Silverlight.&lt;/p&gt;

&lt;p&gt;The first addition is the DisplayInfo class. We'll use this to
hold information about a single monitor.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
namespace PeteBrown.SilverlightBigWindow&lt;br /&gt;
{&lt;br /&gt;
    public class DisplayInfo&lt;br /&gt;
    {&lt;br /&gt;
        public string MonitorName { get; internal set; }&lt;br /&gt;
        public Win32Rect MonitorArea { get; internal set; }&lt;br /&gt;
        public Win32Rect WorkArea { get; internal set; }&lt;br /&gt;
        public int Width { get; internal set; }&lt;br /&gt;
        public int Height { get; internal set; }&lt;br /&gt;
        public bool IsPrimary { get; internal set; }&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Next, I need a way to populate this class. Here's where all the
PInvoke action happens.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
using System;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using System.Collections.ObjectModel;&lt;br /&gt;
&lt;br /&gt;
namespace PeteBrown.SilverlightBigWindow&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
    [StructLayout(LayoutKind.Sequential)]&lt;br /&gt;
    public struct Win32Rect&lt;br /&gt;
    {&lt;br /&gt;
        public int Left { get; set; }&lt;br /&gt;
        public int Top { get; set; }&lt;br /&gt;
        public int Right { get; set; }&lt;br /&gt;
        public int Bottom { get; set; }&lt;br /&gt;
&lt;br /&gt;
        public override string ToString()&lt;br /&gt;
        {&lt;br /&gt;
            return string.Format("{0}, {1}, {2}, {3}", Left, Top, Right, Bottom);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]&lt;br /&gt;
    internal struct MonitorInfoEx&lt;br /&gt;
    {&lt;br /&gt;
        public int Size;&lt;br /&gt;
        public Win32Rect Monitor;&lt;br /&gt;
        public Win32Rect WorkArea;&lt;br /&gt;
        public uint Flags;&lt;br /&gt;
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = DisplayManager.DeviceNameCharacterCount)]&lt;br /&gt;
        public string DeviceName;&lt;br /&gt;
&lt;br /&gt;
        public void Init()&lt;br /&gt;
        {&lt;br /&gt;
            this.Size = 40 + 2 * DisplayManager.DeviceNameCharacterCount;&lt;br /&gt;
            this.DeviceName = string.Empty;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
    public class DisplayManager&lt;br /&gt;
    {&lt;br /&gt;
        // size of a device name string&lt;br /&gt;
        internal const int DeviceNameCharacterCount = 32;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private delegate bool MonitorEnumProcDelegate(IntPtr hMonitor, IntPtr hdcMonitor, ref Win32Rect lprcMonitor, uint dwData);&lt;br /&gt;
&lt;br /&gt;
        [DllImport("user32.dll")]&lt;br /&gt;
        private static extern bool EnumDisplayMonitors(IntPtr hdc, IntPtr lprcClip, MonitorEnumProcDelegate lpfnEnum, uint dwData);&lt;br /&gt;
&lt;br /&gt;
        [DllImport("user32.dll", CharSet = CharSet.Auto)]&lt;br /&gt;
        private static extern bool GetMonitorInfo(IntPtr hMonitor, ref MonitorInfoEx lpmi);&lt;br /&gt;
&lt;br /&gt;
        private static ObservableCollection&amp;lt;DisplayInfo&amp;gt; _displays = new ObservableCollection&amp;lt;DisplayInfo&amp;gt;();&lt;br /&gt;
        public static ObservableCollection&amp;lt;DisplayInfo&amp;gt; Displays&lt;br /&gt;
        {&lt;br /&gt;
            get { return _displays; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static void LoadDisplays()&lt;br /&gt;
        {&lt;br /&gt;
            EnumDisplayMonitors(IntPtr.Zero, IntPtr.Zero, MonitorEnumProc, 0);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        [AllowReversePInvokeCalls]&lt;br /&gt;
        internal static bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref Win32Rect lprcMonitor, uint dwData)&lt;br /&gt;
        {&lt;br /&gt;
            var monitor = new MonitorInfoEx();&lt;br /&gt;
            monitor.Init();&lt;br /&gt;
&lt;br /&gt;
            bool success = GetMonitorInfo(hMonitor, ref monitor);&lt;br /&gt;
&lt;br /&gt;
            if (success)&lt;br /&gt;
            {&lt;br /&gt;
                var display = new DisplayInfo();&lt;br /&gt;
&lt;br /&gt;
                display.MonitorName = monitor.DeviceName;&lt;br /&gt;
&lt;br /&gt;
                display.Width = monitor.Monitor.Right - monitor.Monitor.Left;&lt;br /&gt;
                display.Height = monitor.Monitor.Bottom - monitor.Monitor.Top;&lt;br /&gt;
&lt;br /&gt;
                display.MonitorArea = monitor.Monitor;&lt;br /&gt;
                display.WorkArea = monitor.WorkArea;&lt;br /&gt;
                display.IsPrimary = (monitor.Flags &amp;gt; 0);&lt;br /&gt;
&lt;br /&gt;
                _displays.Add(display);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return true;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;This code calls EnumDisplayMonitors to enumerate the monitors on
the system. For each monitor found, I then call GetMonitorInfo to
pull back the details. From that call, I create a DisplayInfo class
and populate it, ready to be used by the rest of the Silverlight
application. The list of DisplayInfo classes is stored in a
class-scope collection.&lt;/p&gt;

&lt;p&gt;Note the "AllowReversePInvokeCalls" attribute on
MonitorEnumProc. That attribute is required for any callbacks. It
also means we couldn't use a simple anonymous delegate for the
callback, as those can't have attributes.&lt;/p&gt;

&lt;p&gt;Finally, a short call in MainPage.xaml and we're able to get the
display sizes&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
public MainPage()&lt;br /&gt;
{&lt;br /&gt;
    InitializeComponent();&lt;br /&gt;
&lt;br /&gt;
    DisplayManager.LoadDisplays();&lt;br /&gt;
&lt;br /&gt;
    DisplayList.ItemsSource = DisplayManager.Displays;&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Run the application. On my screen, it looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83410/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_12.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83415/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb_5.png" width="650" height="177" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, so now we know how to position a display using hard-coded
values, and how to get the display list from windows. Now, to
combine the two to help with sizing and positioning.&lt;/p&gt;

&lt;h3&gt;Positioning and Sizing the Window&lt;/h3&gt;

&lt;p&gt;Positioning the window can be tricky. There are any number of
ways that monitors can be configured. Here are just a few
interesting (and common) ones, in addition to the ones mentioned
above:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83420/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_16.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83425/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb_7.png" width="650" height="176" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you look at the teal and the green examples, you can see
where a rectangular pixel mapping puts some logical pixels out into
never-never land. On systems like that, a single window spanning
all displays is not particularly practical. In any case, most
multi-display configurations are two, or at most, three displays
because that's all you can typically drive from a single typical
video card.&lt;/p&gt;

&lt;p&gt;As an aside, I've run with all four examples shown above, plus a
few extras. My current layout is 2x 30" displays side by side with
primary on right and secondary on left, plus a 23" display on top
of the primary. The 23" display is connected to a different
computer, however, and shared using Input Director, so it doesn't
factor into this discussion.&lt;/p&gt;

&lt;p&gt;With just the two displays I have, it's easy to test a number of
different scenarios simply by changing resolution and monitor
position in display settings. First, some code to position the
window on a specific screen.&lt;/p&gt;

&lt;h4&gt;Position Window on Primary Display&lt;/h4&gt;

&lt;p&gt;A PC can have only one primary display. Conveniently, the
display is called out as such via the API.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void PositionWindowOnSingleScreen(DisplayInfo screen, Window window, bool SizeToScreen = true, bool maximize = false)&lt;br /&gt;
{&lt;br /&gt;
    window.Left = screen.MonitorArea.Left;&lt;br /&gt;
    window.Top = screen.MonitorArea.Top;&lt;br /&gt;
&lt;br /&gt;
    if (SizeToScreen)&lt;br /&gt;
    {&lt;br /&gt;
        window.Width = screen.Width;&lt;br /&gt;
        window.Height = screen.Height;&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
    if (maximize)&lt;br /&gt;
        window.WindowState = WindowState.Maximized;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
private void OpenPrimary_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    if (DisplayManager.Displays.Count &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
        // find primary display&lt;br /&gt;
        DisplayInfo info = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                            where di.IsPrimary&lt;br /&gt;
                            select di).FirstOrDefault();&lt;br /&gt;
&lt;br /&gt;
        if (info != null)&lt;br /&gt;
        {&lt;br /&gt;
            Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
            PositionWindowOnSingleScreen(info, w, true, false);&lt;br /&gt;
&lt;br /&gt;
            w.Show();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            MessageBox.Show("No primary display. I suppose you won't see this message.");&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show("Display list not yet loaded.");&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;This example uses a little LINQ to find the primary screen and
then a separate function to position the window on that screen. I
can't think of a case where you'd have no primary display, but I
check for it anyway.&lt;/p&gt;

&lt;h4&gt;Position Window on Secondary Display&lt;/h4&gt;

&lt;p&gt;Primary is cool. You can do that without any API calls.
Secondary is normally a little more work, but I have you
covered.&lt;/p&gt;

&lt;p&gt;You can, of course, have more than one secondary display. In my
case, I have only one, so I'm going to position this window in the
first secondary display I have.&lt;/p&gt;

&lt;pre class="brush: csharp; highlight: [7];"&gt;
private void OpenSecondary_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    if (DisplayManager.Displays.Count &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
        // find first secondary display&lt;br /&gt;
        DisplayInfo info = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                            where !di.IsPrimary&lt;br /&gt;
                            select di).FirstOrDefault();&lt;br /&gt;
&lt;br /&gt;
        if (info != null)&lt;br /&gt;
        {&lt;br /&gt;
            Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
            PositionWindowOnSingleScreen(info, w, true, false);&lt;br /&gt;
&lt;br /&gt;
            w.Show();&lt;br /&gt;
        }&lt;br /&gt;
        else&lt;br /&gt;
        {&lt;br /&gt;
            MessageBox.Show("No secondary display available.");&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show("Display list not yet loaded.");&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;In this case, all I needed to change was the error message and
add a little bang in the where clause of the LINQ query.&lt;/p&gt;

&lt;h4&gt;Make a window take up all Display Space&lt;/h4&gt;

&lt;p&gt;This goes specifically to the 3x3 screen scenario. As I
mentioned, we'll need to assume rectangular window space here, as
anything else is going to be pretty application-specific.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void OpenWindow_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    if (DisplayManager.Displays.Count &amp;gt; 0)&lt;br /&gt;
    {&lt;br /&gt;
        Window w = new Window();&lt;br /&gt;
&lt;br /&gt;
        w.Left = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                  select di.MonitorArea.Left).Min();&lt;br /&gt;
&lt;br /&gt;
        w.Top = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                 select di.MonitorArea.Top).Min();&lt;br /&gt;
&lt;br /&gt;
        w.Width = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                   select di.Width).Sum();&lt;br /&gt;
&lt;br /&gt;
        w.Height = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                    select di.Height).Sum();&lt;br /&gt;
&lt;br /&gt;
        w.Show();&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show("Display list not yet loaded.");&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Because we're assuming a reasonably logical rectangle, I can
simply take the minimum left and top values and use that to
position the window, and then sum the height and width values in
order to size the window.&lt;/p&gt;

&lt;p&gt;As an aside, Silverlight had no issues opening this window on my
machine. I'm not sure I'd recommend stretching a video across it,
though.&lt;/p&gt;

&lt;p&gt;Well, actually, I can't let that lie out there like that. Let's
try it. Add this code right after the w.Height setting and before
the w.Show() line&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
MediaElement video = new MediaElement();&lt;br /&gt;
video.Width = w.Width;&lt;br /&gt;
video.Height = w.Height;&lt;br /&gt;
video.Source = new Uri("/pub/sl5iA/NetduinoRobot_SmallM.wmv", UriKind.Absolute);&lt;br /&gt;
video.Stretch = Stretch.UniformToFill;&lt;br /&gt;
video.AutoPlay = true;&lt;br /&gt;
&lt;br /&gt;
w.Content = video;
&lt;/pre&gt;

&lt;p&gt;I stretch the video so it takes up all space (UniformToFill) and
clips the video so the aspect ratio stays correct. It works, and
works well, If the the video was high enough resolution, it would
even look good.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83430/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_18.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83435/Windows-Live-Writer_Creating-Big-Silverlight-Windows_123FB_image_thumb_8.png" width="531" height="166" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sweet! Big video. That's almost like IMax or &lt;a
href="http://en.wikipedia.org/wiki/Ultra_High_Definition_Television"&gt;
UHDTV&lt;/a&gt; :)&lt;/p&gt;

&lt;h4&gt;Position Main Window on a Named Display&lt;/h4&gt;

&lt;p&gt;This is particularly useful if you're restoring windows when
starting up a new session. You could store the display device name
and then do some checks on startup and if the device name and
resolution are still valid (they could have swapped displays,
bought new ones, got rid of one, etc.) position the window on that
display. If not, position it on the main display.&lt;/p&gt;

&lt;p&gt;In this case, I'm simply going to position the main Silverlight
window on to the display you click on in the ListBox. The code is
simple enough. First, add a button to the MainPage, under the other
buttons.&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;Button Content="Move to Selected"&lt;br /&gt;
        Height="23"&lt;br /&gt;
        HorizontalAlignment="Left"&lt;br /&gt;
        Margin="12,115,0,0"&lt;br /&gt;
        Name="MoveToSelectedButton"&lt;br /&gt;
        VerticalAlignment="Top"&lt;br /&gt;
        Width="108"&lt;br /&gt;
        Click="MoveToSelectedButton_Click" /&amp;gt;&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;Next, the event handler and work function in the code-behind.
&lt;strong&gt;There are many ways I could have done this (especially
using SelectedItem), but I specifically want to show using the
device name&lt;/strong&gt;. I know it's extra work, but I'm doing it
on-purpose; the value you store upon exiting is not going to be an
object instance, it's going to be a screen device name string.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void MoveMainWindowToSelectedDisplay()&lt;br /&gt;
{&lt;br /&gt;
    // see comments in blog post as to why I went with strings&lt;br /&gt;
    string deviceName = ((DisplayInfo)DisplayList.SelectedItem).MonitorName;&lt;br /&gt;
&lt;br /&gt;
    DisplayInfo display = (from DisplayInfo di in DisplayManager.Displays&lt;br /&gt;
                            where di.MonitorName.ToLower() == deviceName.ToLower()&lt;br /&gt;
                            select di).FirstOrDefault();&lt;br /&gt;
&lt;br /&gt;
    var mainWindow = Application.Current.MainWindow;&lt;br /&gt;
&lt;br /&gt;
    // center on the display&lt;br /&gt;
&lt;br /&gt;
    mainWindow.Left = display.MonitorArea.Left + (display.Width - mainWindow.Width) / 2;&lt;br /&gt;
    mainWindow.Top = display.MonitorArea.Top + (display.Height - mainWindow.Height) / 2;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
private void MoveToSelectedButton_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    if (DisplayList.SelectedItem != null)&lt;br /&gt;
    {&lt;br /&gt;
        MoveMainWindowToSelectedDisplay();&lt;br /&gt;
    }&lt;br /&gt;
    else&lt;br /&gt;
    {&lt;br /&gt;
        MessageBox.Show("Please select a screen from the list");&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The code moves the window to the selected monitor and then
centers in that monitor. Some additional checking to make sure the
window isn't wider than that monitor would be a good idea.&lt;/p&gt;

&lt;h3&gt;Summary&lt;/h3&gt;

&lt;p&gt;The intent of this post was to give you the foundation you'll
need in order to do window manipulation in Silverlight. Once you
start doing multi-monitor window manipulation, you probably have a
good idea of what you want to do with it. I'll leave it up to you
to take this code and run with it to suit your specific application
needs.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/abTfC3bvPnuqH0QldgCE0SY_eBw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/abTfC3bvPnuqH0QldgCE0SY_eBw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/abTfC3bvPnuqH0QldgCE0SY_eBw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/abTfC3bvPnuqH0QldgCE0SY_eBw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/LnBVZe8RTLI" height="1" width="1"/&gt;</description></item><item><title>The Commodore 64 Emulator: Emulating Pointers in a sandbox when the real thing is not allowed</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/02/06/the-commodore-64-emulator-emulating-pointers-in-a-sandbox-when-the-real-thing-is-not-allowed</link><pubDate>Tue, 07 Feb 2012 00:02:46 GMT</pubDate><guid>http://10rem.net/blog/2012/02/06/the-commodore-64-emulator-emulating-pointers-in-a-sandbox-when-the-real-thing-is-not-allowed</guid><description>&lt;p&gt;Late last week, I cracked open the &lt;a
href="http://silverlightc64.codeplex.com/"&gt;Commodore 64 emulator
code&lt;/a&gt; once again, in preparation to post it. However, I had to
have a change made to the source control on CodePlex, so I had a
few days to make some changes. So far, it's shaping up quite
nicely:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83308/Windows-Live-Writer_1244081fb4e8_EF48_image_16.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83313/Windows-Live-Writer_1244081fb4e8_EF48_image_thumb_7.png" width="320" height="202" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;a
href="http://10rem.net/media/83318/Windows-Live-Writer_1244081fb4e8_EF48_image_18.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83323/Windows-Live-Writer_1244081fb4e8_EF48_image_thumb_8.png" width="320" height="202" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I went back to the latest version of the &lt;a
href="http://www.cebix.net/viewcvs/cebix/Frodo4/Src/"&gt;Frodo C64
emulator source code&lt;/a&gt; and decided to port some of their changes
over to this version. Frodo is written in C and C++, and makes very
heavy use of pointers (and not always safe use of them, as there
was at least one logical overrun). In the previous version, I had
replaced pointers with array manipulation, but I did it in a way
that resulted in an awful lot of array copies floating around. The
arrays were small, so this wasn't a big deal memory-wise, but the
copies all took time in an otherwise time-critical application.&lt;/p&gt;

&lt;p&gt;Silverlight doesn't support pointers or unsafe code. Of course,
in elevated trust mode, with a not-really-supported hack, you can
have pointers in Silverlight. However, I wanted to stay away from
that for now as it only works in Silverlight 5, only on Windows,
and won't port to any other sandboxed XAML platforms.&lt;/p&gt;

&lt;p&gt;So, I decided to finish what I started and build out some decent
almost-pointerish safe analogs in Silverlight. It was a fairly
large amount of effort, but I thought it might also be interesting
to read about here.&lt;/p&gt;

&lt;h3&gt;How Pointers Work&lt;/h3&gt;

&lt;p&gt;If you've never written any C/C++ code, there's a better than
zero chance that you haven't done any explicit pointer manipulation
in your own code. That's not a bad thing, really, as the typical
business application (and many other types) simply doesn't need to
do pointer arithmetic. It's not worth the inherent danger for the
small performance increase. That said, &lt;strong&gt;an understanding of
how pointers work is&amp;nbsp; fundamental computer science, and is
important for all developers to know.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's only when you have to do a lot of memory walking in a
performance-critical application that you run into this. &lt;a
href="http://10rem.net/blog/2012/01/15/gnu-cplusplus-blinkenled-part-1-on-the-avr-atmega1284p-with-mikroelektronika-easyavr6-and-atmel-avr-studio-51"&gt;
Programming for microcontrollers like the AVR&lt;/a&gt; is a great way to
refresh your memory as to how pointers work and what they bring to
the table.&lt;/p&gt;

&lt;p&gt;A pointer is an address in memory and an associated type size.
For example, if we have some fictional 6 byte memory chunk and
declare a pointer to a byte, we end up with something like this
(bonus points if you can figure out the significance of the 5 bytes
starting at 0x01):&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83328/Windows-Live-Writer_1244081fb4e8_EF48_image_8.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83333/Windows-Live-Writer_1244081fb4e8_EF48_image_thumb_3.png" width="650" height="204" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this case, our byte pointer points to the 8 bits starting at
the address 0x01. You can then manipulate memory using pointer
arithmetic:&lt;/p&gt;

&lt;pre class="brush: cpp;"&gt;
byte* p = 0x01;    // declare pointer to memory address 0x01&lt;br /&gt;
&lt;br /&gt;
*p = 0x30;         // changes value at 0x01 to 0x30 from 0x78&lt;br /&gt;
&lt;br /&gt;
*(p+3) = 0x00;     // changes value at 0x04 to 0x00 from 0x7A&lt;br /&gt;
&lt;br /&gt;
while (p &amp;lt; 0x06)   // clear rest of memory&lt;br /&gt;
  *p++ = 0x00;
&lt;/pre&gt;

&lt;p&gt;This is very fast because there really is no indirection. You're
telling the compiler exactly what address to manipulate - it
doesn't have to look anything up.&lt;/p&gt;

&lt;p&gt;The size of the pointer variable has to do with the architecture
of the system and its addressing scheme (8 bit, 16 bit, 32 bit, 64
bit), as well as compiler options you select. (In the case of the
Commodore 64, it's all 8 bit.).&lt;/p&gt;

&lt;p&gt;You're not limited to the smallest memory unit size, though. If
you wanted to declare a pointer to a 16 bit integer, you'd get this
(assuming "short" is 16 bits on your system):&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83338/Windows-Live-Writer_1244081fb4e8_EF48_image_10.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83343/Windows-Live-Writer_1244081fb4e8_EF48_image_thumb_4.png" width="650" height="204" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, depending on the &lt;a
href="http://en.wikipedia.org/wiki/Endian"&gt;endian-ness&lt;/a&gt; of your
system, the resulting 16 bit number may be 0x7879 (big endian) or
0x7978 (little endian).&lt;/p&gt;

&lt;p&gt;It starts to get really powerful when you consider that a
pointer to a structure could also be considered a pointer to a
number of bytes. That allows you to, for example, read a bunch of
bytes from a disk, look at the first couple bytes to figure out
what you have, and then cast the remaining X bytes as the pointer a
directory structure or something. The original C++ C64 emulator
code does a ton of that.&lt;/p&gt;

&lt;h4&gt;How pointers are used in Frodo&lt;/h4&gt;

&lt;p&gt;In addition to pointers to structures in byte buffers, frodo
does a lot of string parsing using pointers. In particular, the
1541 drive emulation code uses this for command parsing. In that
code, the first character is often some command identifier, the
next is a delimiter (like a colon) and then some number of
comma-separated values.&lt;/p&gt;

&lt;p&gt;In our normal pointer-less code, we'd typically parse the string
and then make copies for each of the individual components. Another
way to deal with it is to simply provide pointers to each of the
sections therefore avoiding making copies of memory. That's
typically how the Frodo code works.&lt;/p&gt;

&lt;p&gt;In my first version of the code, I used array indexes to
simulate this. However, that code got incredibly nasty to work
with. I needed another solution.&lt;/p&gt;

&lt;h3&gt;The Simulated Pointer&lt;/h3&gt;

&lt;p&gt;You can simulate pointers by simply passing around arrays,
making copies, or even using array indexes. But, as I mentioned,
that code tends to get pretty messy as you have lots of dependent
variables. Instead, I needed a way to encapsulate all of this and
provide pointer-like functionality to handle the majority of the
cases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The primary goal of this effort is to make it easy to have code
which is close to 1:1 with its C++ counterparts. For example, if
the C++ code increments a pointer and then assigns a value, I want
to be able to do something similar without having to worry about
which array the pointer points to, or what index value is. The code
won't be 1:1, but I want it as close as possible.&lt;/li&gt;

&lt;li&gt;Another goal of this effort is to minimize the number of times
I copy arrays around. Primarily this is for performance reasons as
the emulator code needs to loop at least one million times a second
(1MHz). Minimizing array copies and object instances helps keep GC
under control as well.&lt;/li&gt;

&lt;li&gt;A non-goal of this effort is efficient use of actual memory. In
fact, my pointer structures use more memory than a pointer just to
simulate a pointer. I'm ok with that.&lt;/li&gt;

&lt;li&gt;Another non-goal is the ability to cast a pointer to a
structure or other complex type. I'd love to do that, but that's
not sandbox-friendly and it's not going to happen that way in this
code.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The C64 code has a number of places where it has memory
allocated in chunks. The most obvious is the main memory of the
system (64K), but there's also 2K in the VIC-1541 drive. Beyond
those, there are several chunks of ROM code which get loaded up and
then mapped into various address locations (cartridges too). In the
emulator code, these are just large arrays of bytes.&lt;/p&gt;

&lt;p&gt;If you ever had to simulate an operating system in college,
you've done this before.&lt;/p&gt;

&lt;p&gt;Here's an example of two pointers "A" and "B". Pointer A points
to address 0x01 in the memory array. Pointer B points to address
0x05.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/83348/Windows-Live-Writer_1244081fb4e8_EF48_image_14.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/83353/Windows-Live-Writer_1244081fb4e8_EF48_image_thumb_6.png" width="650" height="272" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code to create these looks something like this:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
SystemRam ram = new SystemRam();&lt;br /&gt;
&lt;br /&gt;
var a = new RamBytePointer(ram, 0x00);&lt;br /&gt;
var b = new RamBytePointer(ram, 0x05);&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;The RamBytePointer structure represents the pointer. It has a
member Value which can be used to get/set the value at that
position. It also has a number of other helper methods to do things
like copy values from arrays, comparisons with other pointers, etc.
Note that the pointer structure takes a reference to the memory it
is allowed to manipulate. A real pointer has pretty much free run
of memory, so you need to keep the RAM pretty broadly defined if
you need that flexibility.&lt;/p&gt;

&lt;p&gt;Here's the current version of the structure. It doesn't do quite
everything I want yet (for example, nothing with comparisons
between pointers, for example), but it does a fair bit.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
using System.Diagnostics;&lt;br /&gt;
using System.Text;&lt;br /&gt;
using System;&lt;br /&gt;
&lt;br /&gt;
namespace PeteBrown.C64.Core.Memory&lt;br /&gt;
{&lt;br /&gt;
    public struct RamBytePointer&lt;br /&gt;
    {&lt;br /&gt;
        public RamBytePointer(RamBase memory, int address)&lt;br /&gt;
            : this(memory)&lt;br /&gt;
        {&lt;br /&gt;
            _address = address;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public RamBytePointer(RamBase memory)&lt;br /&gt;
        {&lt;br /&gt;
            _memory = memory;&lt;br /&gt;
            _address = 0;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private RamBase _memory;&lt;br /&gt;
        private RamBase Memory&lt;br /&gt;
        {&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            get { return _memory; }&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            set { _memory = value; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private int _address;&lt;br /&gt;
        public int Address&lt;br /&gt;
        {&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            get { return _address; }&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            set { _address = value; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public byte this[int offset]&lt;br /&gt;
        {&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            get { return _memory[_address + offset]; }&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            set { _memory[_address + offset] = value; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public byte Value&lt;br /&gt;
        {&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            get { return _memory[_address]; }&lt;br /&gt;
            [DebuggerStepThrough]&lt;br /&gt;
            set { _memory[_address] = value; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public byte[] GetValues(int length)&lt;br /&gt;
        {&lt;br /&gt;
            return _memory.Read(_address, length);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public void SetValues(byte[] values)&lt;br /&gt;
        {&lt;br /&gt;
            _memory.Write(_address, values);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public void CopyFrom(byte[] values, bool incrementPointer)&lt;br /&gt;
        {&lt;br /&gt;
            for (int i = 0; i &amp;lt; values.Length; i++)&lt;br /&gt;
            {&lt;br /&gt;
                _memory[_address + i] = values[i];&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (incrementPointer)&lt;br /&gt;
                _address += values.Length;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public void CopyFrom(char[] characters, bool incrementPointer)&lt;br /&gt;
        {&lt;br /&gt;
            for (int i = 0; i &amp;lt; characters.Length; i++)&lt;br /&gt;
            {&lt;br /&gt;
                _memory[_address + i] = (byte)characters[i];&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (incrementPointer)&lt;br /&gt;
                _address += characters.Length;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public void CopyFrom(string characters, bool incrementPointer)&lt;br /&gt;
        {&lt;br /&gt;
            for (int i = 0; i &amp;lt; characters.Length; i++)&lt;br /&gt;
            {&lt;br /&gt;
                _memory[_address + i] = (byte)characters[i];&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            if (incrementPointer)&lt;br /&gt;
                _address += characters.Length;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public RamBytePointer NewPointerAtOffset(int offset)&lt;br /&gt;
        {&lt;br /&gt;
            return new RamBytePointer(_memory, _address + offset);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static RamBytePointer operator +(RamBytePointer p, int offset)&lt;br /&gt;
        {&lt;br /&gt;
            return new RamBytePointer(p.Memory, p.Address + offset);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static RamBytePointer operator -(RamBytePointer p, int offset)&lt;br /&gt;
        {&lt;br /&gt;
            return new RamBytePointer(p.Memory, p.Address - offset);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public static RamBytePointer operator ++(RamBytePointer p)&lt;br /&gt;
        {&lt;br /&gt;
            p.Address += 1;&lt;br /&gt;
&lt;br /&gt;
            return p;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public static RamBytePointer operator --(RamBytePointer p)&lt;br /&gt;
        {&lt;br /&gt;
            p.Address -= 1;&lt;br /&gt;
&lt;br /&gt;
            return p;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public int IndexOf(byte value, int count)&lt;br /&gt;
        {&lt;br /&gt;
            return _memory.IndexOf(value, 0, count);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public int IndexOf(char value, int count)&lt;br /&gt;
        {&lt;br /&gt;
            return _memory.IndexOf(value, 0, count);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public bool Contains(char value, int count)&lt;br /&gt;
        {&lt;br /&gt;
            return _memory.Contains(value, 0, count);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public bool Contains(byte value, int count)&lt;br /&gt;
        {&lt;br /&gt;
            return _memory.Contains(value, 0, count);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        public string ToString(int startIndex, int length)&lt;br /&gt;
        {&lt;br /&gt;
            StringBuilder builder = new StringBuilder();&lt;br /&gt;
&lt;br /&gt;
            for (int i = startIndex; i &amp;lt; length; i++)&lt;br /&gt;
            {&lt;br /&gt;
                builder.Append((char)_memory[i]);&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
            return builder.ToString();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;The memory array itself is always created and maintained outside
of this class. It must be valid when the pointer is created.&lt;/p&gt;

&lt;h4&gt;Operator overloading and Offsets&lt;/h4&gt;

&lt;p&gt;Of interest is the operator overloading. This allows me to do
things like p++ or p += 1 in order to modify the address that the
pointer is pointing to. That's an important part of keeping the C#
code as similar as possible to the C++ code. However, it doesn't
allow everything the C++ code allows. For example, I can't do the
exact equivalent of this code:&lt;/p&gt;

&lt;pre class="brush: cpp;"&gt;
*(p + 5) = 0x05;&lt;br /&gt;
*(p - 7) = 0x0A;
&lt;/pre&gt;

&lt;p&gt;If I try to do the equivalent of that, the compiler will barf at
me as it needs an actual LValue on the left side. Instead, code
like that must use something like this:&lt;/p&gt;

&lt;pre class="brush: cpp;"&gt;
p[5] = 0x05;&lt;br /&gt;
p[-7] = 0x0A;
&lt;/pre&gt;

&lt;p&gt;The code is similar enough that I'm happy with it, although
developers new to the code may raise a few eyebrows at the p[-7]
version.&lt;/p&gt;

&lt;h4&gt;Converting Strings&lt;/h4&gt;

&lt;p&gt;Because much of the C++ code treats characters and bytes as
interchangeable (something you can't really do with arrays in C# on
Windows), I also have a few overloads that can take characters or
bytes. This helps clean up the consuming code so it doesn't have so
many casts.&lt;/p&gt;

&lt;p&gt;I have helper functions in there to copy from strings. This
helps me easily translate code such as this:&lt;/p&gt;

&lt;pre class="brush: cpp;"&gt;
*p++ = 'B';&lt;br /&gt;
*p++ = 'L';&lt;br /&gt;
*p++ = 'O';&lt;br /&gt;
*p++ = 'C';&lt;br /&gt;
*p++ = 'K';&lt;br /&gt;
*p++ = 'S';&lt;br /&gt;
*p++ = ' ';&lt;br /&gt;
*p++ = 'F';&lt;br /&gt;
*p++ = 'R';&lt;br /&gt;
*p++ = 'E';&lt;br /&gt;
*p++ = 'E';&lt;br /&gt;
*p++ = '.';
&lt;/pre&gt;

&lt;p&gt;Into a nice single-liner like p.CopyFrom("BLOCKS FREE.",
true);&lt;/p&gt;

&lt;h4&gt;A Structure, not a Class&lt;/h4&gt;

&lt;p&gt;Note that this is a structure, not a class. Why? Having it as a
structure lets me make copies easily. It's common practice in C/C++
code to have a pointer passed into a function, and then make a copy
of it to increment yourself. For example:&lt;/p&gt;

&lt;pre class="brush: cpp;"&gt;
void DoSomething (byte * baseAddress)&lt;br /&gt;
{&lt;br /&gt;
    byte * p = baseAddress;&lt;br /&gt;
&lt;br /&gt;
    while (p++ != 0x0A)&lt;br /&gt;
        ...&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;In this example C++ function, p starts off at the same address
as "baseAddress", but then increments it. The value for baseAddress
must be left alone.&lt;/p&gt;

&lt;p&gt;Reference types like class in C# are themselves pointers. So,
due to the level of indirection this has, we'd end up modifying the
original value:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
class RamBytePointer { ... }&lt;br /&gt;
&lt;br /&gt;
void DoSomething (RamBytePointer baseAddress)&lt;br /&gt;
{&lt;br /&gt;
    RamBytePointer p = baseAddress;&lt;br /&gt;
&lt;br /&gt;
    p += 5;&lt;br /&gt;
&lt;br /&gt;
    Debug.WriteLine(p.Address);&lt;br /&gt;
    Debug.WriteLine(baseAddress.Address);&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// ---------------------------------------&lt;br /&gt;
&lt;br /&gt;
struct RamBytePointer { ... }&lt;br /&gt;
&lt;br /&gt;
void DoSomething (RamBytePointer baseAddress)&lt;br /&gt;
{&lt;br /&gt;
    RamBytePointer p = baseAddress;&lt;br /&gt;
&lt;br /&gt;
    p += 5;&lt;br /&gt;
&lt;br /&gt;
    Debug.WriteLine(p.Address);&lt;br /&gt;
    Debug.WriteLine(baseAddress.Address);&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The first example doesn't work like pointers in C++ at all.
Incrementing p also increments baseAddress. The second example,
however, works as we would expect because p is a copy of
baseAddress, not a reference to it.&lt;/p&gt;

&lt;p&gt;The downside of using a struct is there's no inheritance. So, I
instead put a fair bit of the potentially reusable code into the
memory classes instead, and simply call that from the pointer
class.&lt;/p&gt;

&lt;h3&gt;Summary&lt;/h3&gt;

&lt;p&gt;Simulating pointers in pointer-free sandboxed platforms is a bit
unorthodox, but can make translating code easier.&lt;/p&gt;

&lt;p&gt;This isn't something you're likely to need to do in your own
code, but it an interesting exercise in any case. There's no
downloadable source code yet, as I'm still refining this
implementation. You'll be able to get a version of these classes in
the &lt;a href="http://silverlightc64.codeplex.com/"&gt;SilverlightC64
code&lt;/a&gt; when I post it in the next week or less. It's taking
longer to swap out all this code than I had intended :)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If you've ever had to do anything like this in your own
code, I'd love to hear about it.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bZ-HyhrEnilDIKKgphf8nXZuvsM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bZ-HyhrEnilDIKKgphf8nXZuvsM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bZ-HyhrEnilDIKKgphf8nXZuvsM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bZ-HyhrEnilDIKKgphf8nXZuvsM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/p4m7Barcbbw" height="1" width="1"/&gt;</description></item><item><title>Windows Client Developer Roundup 086 for 1/11/2012</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/01/11/windows-client-developer-roundup-086-for-1-11-2012</link><pubDate>Thu, 12 Jan 2012 01:02:35 GMT</pubDate><guid>http://10rem.net/blog/2012/01/11/windows-client-developer-roundup-086-for-1-11-2012</guid><description>&lt;p&gt;The Windows Client Developer Roundup aggregates information of
interest to Windows Client Developers, including &lt;a
href="http://dev.windows.com/"&gt;WinRT XAML&lt;/a&gt;, &lt;a
href="http://windowsclient.net/"&gt;WPF&lt;/a&gt;, &lt;a
href="http://silverlight.net/"&gt;Silverlight&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/visualc/default.aspx"&gt;Visual
C++&lt;/a&gt;, &lt;a href="http://creators.xna.com/"&gt;XNA&lt;/a&gt;, &lt;a
href="http://expression.microsoft.com/"&gt;Expression Blend&lt;/a&gt;, &lt;a
href="http://www.microsoft.com/surface/"&gt;Surface&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/windows/default.aspx"&gt;Windows
7&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/ff380145.aspx"&gt;Windows
Phone&lt;/a&gt;, Visual Studio, &lt;a
href="http://silverlight.net/riaservices/"&gt;WCF RIA Services&lt;/a&gt; and
more. Sometimes I even include a little jQuery and HTML5. If you
have something interesting you've done or have run across, or you
blog regularly on the topics included here, please send me the URL
and brief description via the &lt;a href="http://10rem.net/contact"&gt;contact
link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note that I've started breaking the Netduino, Electronics,
Robotics, Synthesizer and similar content into a new roundup series
called the &lt;a href="http://10rem.net/blog?filterby=MakerRoundup"&gt;Maker Geek
Roundup&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Shout-Outs&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/visualstudio/archive/2012/01/04/give-us-your-feedback-on-visual-studio-11-and-receive-a-gift.aspx"&gt;
Give us your feedback on Visual Studio 11 etc. and receive a
gift!&lt;/a&gt; (Visual Studio Blog)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Windows 8 and WinRT/Metro General&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/davedev/archive/2012/01/05/windows-8-first-apps-contest.aspx"&gt;
Windows 8 - First Apps Contest&lt;/a&gt; (Dave Isbitski)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://kellabyte.com/2011/12/19/when-metro-design-falls-off-the-tracks/"&gt;
When Metro design falls off the tracks&lt;/a&gt; (Kelly Sommers)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.sharpgis.net/post/2011/12/11/Make-your-Windows-8-Video-App-use-the-PlayTo-feature.aspx"&gt;
SharpGIS | Make your Windows 8 Video App use the PlayTo feature&lt;/a&gt;
(Morten Nielsen)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;XAML Technologies (Silverlight, WPF, WinRT Metro XAML)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://www.andybeaulieu.com/Home/tabid/67/EntryID/223/Default.aspx"&gt;
"Physamajig" for Windows 8&lt;/a&gt; (Andy Beaulieu)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.sharpgis.net/post/2011/12/07/Building-an-Augmented-Reality-XAML-control.aspx"&gt;
Building an Augmented Reality XAML control&lt;/a&gt; (Morten
Nielsen)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;WinJS / JavaScript and HTML Applications for Windows Metro&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://adamkinney.com/blog/2011/12/07/setting-up-your-first-use-of-the-animation-library-in-winjs/"&gt;
Setting up your first use of the Animation library in WinJS&lt;/a&gt;
(Adam Kinney)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://adamkinney.com/blog/2011/12/05/no-alert-in-winjs-use-console-or-messagedialog-instead/"&gt;
No Alert in WinJS! Use console or MessageDialog instead&lt;/a&gt; (Adam
Kinney)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Direct X Technologies (DirectX, XNA, WinRT DirectX, General GPU
and Game Programming)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://geekswithblogs.net/mikebmcl/archive/2011/12/31/getting-started-with-metro-style-directx.aspx"&gt;
Getting started with Metro style DirectX&lt;/a&gt; (Bob Taco
Industries)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://digitalerr0r.wordpress.com/2011/12/12/xna-4-0-shader-programming-1intro-to-hlsl-ambient-light/"&gt;
XNA 4.0 Shader Programming #1-Intro to HLSL, Ambient light&lt;/a&gt;
(digitalerr0r)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://digitalerr0r.wordpress.com/2011/12/13/xna-4-0-shader-programming-2diffuse-light/"&gt;
XNA 4.0 Shader Programming #2-Diffuse light&lt;/a&gt; (digitalerr0r)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://digitalerr0r.wordpress.com/2011/12/20/xna-4-0-shader-programming-3specular-light/"&gt;
XNA 4.0 Shader Programming #3-Specular light&lt;/a&gt;
(digitalerr0r)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;C++ and Native Development&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/sdl/archive/2011/12/02/security.aspx"&gt;
Compiler Security Enhancements in Visual Studio 11&lt;/a&gt; (SDL
Team)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Visual Studio and .NET General&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/somasegar/archive/2011/12/15/visual-studio-11-platform-tooling-advances.aspx"&gt;
Visual Studio 11 Platform Tooling Advances&lt;/a&gt; (Soma)&lt;/li&gt;

&lt;li style="list-style: none"&gt;
&lt;ul&gt;
&lt;li&gt;Good DirectX content in this one as well&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/delay/archive/2012/01/09/make-things-as-simple-as-possible-but-not-simpler-managedmsiexec-sample-app-shows-how-to-use-the-windows-installer-api-from-managed-code.aspx"&gt;
ManagedMsiExec sample app shows how to use the Windows Installer
API from managed code&lt;/a&gt; (David Anson)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;NUI (Kinect, Surface, More)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://kinecthacks.net/microsoft-kinect-coming-to-windows-on-february-1st-up-for-pre-order-now/"&gt;
Microsoft Kinect coming to Windows on February 1st, up for
pre-order now!&lt;/a&gt; (KinectHacks)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://robrelyea.wordpress.com/2012/01/11/kinect-apps-ensuring-kinect-runtime-is-installed/"&gt;
Kinect Apps - ensuring Kinect Runtime is installed&lt;/a&gt; (Rob
Relyea)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://robrelyea.wordpress.com/2011/12/17/depth-api-improvements-in-v1/"&gt;
Examples of depth API improvements coming in v1&lt;/a&gt; (Rob
Relyea)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://channel9.msdn.com/coding4fun/kinect/Kinect--3D--Fusion4D"&gt;
Kinect + 3D = Fusion4D&lt;/a&gt; (Greg Duncan)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://channel9.msdn.com/coding4fun/blog/Connecting-your-Netduino-to-your-Kinect"&gt;
Connecting your Netduino to your Kinect&lt;/a&gt; (Greg Duncan)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://digitalerr0r.wordpress.com/2011/12/13/kinect-fundamentals-4-implementing-skeletal-tracking/"&gt;
Kinect Fundamentals #4: Implementing Skeletal Tracking |
digitalerr0r&lt;/a&gt; (digitalerr0r)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://studentguru.gr/b/vangos/archive/2012/01/01/kinect-amp-html5-using-websockets-and-canvas.aspx"&gt;
Kinect &amp;amp; HTML5 using WebSockets and Canvas&lt;/a&gt; (Vangos
Pterneas)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Off-Topic Fun&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://poorlydrawnlines.com/comic/when-its-cold/"&gt;Poorly
Drawn Lines - When It's Cold&lt;/a&gt; (for all the ADD types)&lt;/li&gt;

&lt;li&gt;&lt;a href="http://xkcd.com/1002/"&gt;xkcd: Game AIs&lt;/a&gt; (xkcd)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.smbc-comics.com/index.php?db=comics&amp;amp;id=2470&amp;amp;"&gt;
Benoit Mandelbrot: Master of seduction&lt;/a&gt; (SMBC)&lt;/li&gt;

&lt;li style="list-style: none"&gt;
&lt;ul&gt;
&lt;li&gt;and &lt;a
href="http://www.smbc-comics.com/index.php?db=comics&amp;amp;id=2471&amp;amp;"&gt;
Saturday Morning Breakfast Cereal&lt;/a&gt;&amp;nbsp;&lt;/li&gt;

&lt;li&gt;and &lt;a
href="http://www.smbc-comics.com/index.php?db=comics&amp;amp;id=2475&amp;amp;"&gt;
Saturday Morning Breakfast Cereal&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.smbc-comics.com/index.php?db=comics&amp;amp;id=2478"&gt;Grammar!&lt;/a&gt;
(SMBC)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://moistproduction.blogspot.com/2011/12/lego-skeleton-cross-section-for-purists.html"&gt;
Lego Skeleton inside Mini Figure (for the purists)&lt;/a&gt;
(MoistProduction)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lDP2LK_V1anwnVEl6L528mR-ty4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lDP2LK_V1anwnVEl6L528mR-ty4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lDP2LK_V1anwnVEl6L528mR-ty4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lDP2LK_V1anwnVEl6L528mR-ty4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/PvD8YY82TMA" height="1" width="1"/&gt;</description></item><item><title>Threading Considerations for Binding and Change Notification in Silverlight 5</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/01/10/threading-considerations-for-binding-and-change-notification-in-silverlight-5</link><pubDate>Tue, 10 Jan 2012 16:48:00 GMT</pubDate><guid>http://10rem.net/blog/2012/01/10/threading-considerations-for-binding-and-change-notification-in-silverlight-5</guid><description>&lt;p&gt;A reader of &lt;a href="http://manning.com/pbrown2"
target="_blank"&gt;my Silverlight 5 book&lt;/a&gt; recently reached out to
me about threading and why I create some objects on the UI thread
in the examples. We discussed some of the reasons, but I felt this
would be a good topic to share with everyone. In fact, this is one
area where it would have been fun to go into great detail in my
book, but there simply wasn't the space. Threading and cross-thread
exceptions can be a bit of a mystery to new Silverlight and WPF
developers.&lt;/p&gt;

&lt;h3&gt;Background&lt;/h3&gt;

&lt;p&gt;The user interface in Silverlight runs on a thread commonly
known as the UI Thread. Any code you create in the code-behind, and
any code it calls all the way down the chain, unless it explicitly
creates another thread, runs on this same UI thread. It's not at
all uncommon to see Silverlight and WPF applications which never
explicitly create a second thread, but do make calls to other
services which create background threads for processing.&lt;/p&gt;

&lt;p&gt;There are many other examples, but networking is one place where
the Silverlight .NET Framework explicitly creates (or uses)
different threads. Not all calls return on the UI thread.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Threads other than the UI thread are not allowed to
access or manipulate UI objects&lt;/strong&gt;. If they attempt to do so,
the runtime throws an Invalid Cross-Thread Access exception. It
looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/82267/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_2.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/82272/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_thumb.png" width="477" height="277" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But wait! I wasn't accessing any UI objects from my code. What
gives?&lt;/p&gt;

&lt;p&gt;It's not always obvious that you're interacting with UI objects
on the UI thread, though. Here's the stack trace from this
particular exception:&lt;/p&gt;

&lt;pre class="brush: csharp; highlight: [2];"&gt;
{System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---&amp;gt;&lt;br /&gt;
  System.UnauthorizedAccessException: Invalid cross-thread access.&lt;br /&gt;
   at MS.Internal.XcpImports.CheckThread()&lt;br /&gt;
   at MS.Internal.XcpImports.GetValue(IManagedPeerBase managedPeer, DependencyProperty property)&lt;br /&gt;
   at System.Windows.DependencyObject.GetOldValue(DependencyProperty property, EffectiveValueEntry&amp;amp; oldEntry)&lt;br /&gt;
   at System.Windows.DependencyObject.UpdateEffectiveValue(DependencyProperty property, EffectiveValueEntry oldEntry, EffectiveValueEntry&amp;amp; newEntry, ValueOperation operation)&lt;br /&gt;
   at System.Windows.DependencyObject.RefreshExpression(DependencyProperty dp)&lt;br /&gt;
   at System.Windows.Data.BindingExpression.SendDataToTarget()&lt;br /&gt;
   at System.Windows.Data.BindingExpression.SourcePropertyChanged(PropertyPathListener sender, PropertyPathChangedEventArgs args)&lt;br /&gt;
   at System.Windows.PropertyPathListener.ReconnectPath()&lt;br /&gt;
   at System.Windows.Data.Debugging.BindingBreakPoint.&amp;lt;&amp;gt;c__DisplayClass4.&amp;lt;BreakOnSharedType&amp;gt;b__3()&lt;br /&gt;
   --- End of inner exception stack trace ---&lt;br /&gt;
   at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)&lt;br /&gt;
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)&lt;br /&gt;
   at System.Delegate.DynamicInvokeImpl(Object[] args)&lt;br /&gt;
   at System.Delegate.DynamicInvoke(Object[] args)&lt;br /&gt;
   at MainPagexaml.BindingOperation(Object BindingState, Int32 , Action )}
&lt;/pre&gt;

&lt;p&gt;This stack trace was generated by &lt;strong&gt;trying to raise a
PropertyChangedNotification when I manipulated a model object from
a background thread&lt;/strong&gt;. So, it was obvious that I was working
with an object on the background thread, but it wasn't obvious that
I'd get a cross-thread exception (well it was in this case, as I
contrived the example). If you consider a larger application where
you have division of ownership for different pieces, a client-side
developer may simply work with your viewmodel, but not realize
you're farming some work out to another thread.&lt;/p&gt;

&lt;p&gt;I wrote a blog post back in 2010 ( &lt;a
href="http://10rem.net/blog/2010/04/23/essential-silverlight-and-wpf-skills-the-ui-thread-dispatchers-background-workers-and-async-network-programming"&gt;
Essential Silverlight and WPF Skills: The UI Thread, Dispatchers,
Background Workers and Async Network Programming&lt;/a&gt;) explaining
some of the ways to work with threads and dispatching. I didn't
have SynchronizationContext in there at the time, but it's
something I tend to use a lot these days.&lt;/p&gt;

&lt;p&gt;Let's take a look at a few of the common scenarios and how it
works with threading.&lt;/p&gt;

&lt;h3&gt;Common Scenarios&lt;/h3&gt;

&lt;p&gt;All of these scenarios make use of a simple Customer class with
a single property:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
namespace SilverlightThreadingExample.Model&lt;br /&gt;
{&lt;br /&gt;
    public class Customer : Observable&lt;br /&gt;
    {&lt;br /&gt;
        private string _firstName;&lt;br /&gt;
        public string FirstName&lt;br /&gt;
        {&lt;br /&gt;
            get { return _firstName; }&lt;br /&gt;
            set { _firstName = value; NotifyPropertyChanged("FirstName"); }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The customer is &lt;em&gt;observable&lt;/em&gt; that is, it notifies any
listeners when properties change. While not necessary, I
encapsulated the observable code in this base class. You could,
instead, put the implementation in a partial class if you wanted to
make sure your model object's signature from your ORM or whatever
remains the same as it was on the server.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
using System.ComponentModel;&lt;br /&gt;
&lt;br /&gt;
namespace SilverlightThreadingExample&lt;br /&gt;
{&lt;br /&gt;
    public class Observable : INotifyPropertyChanged&lt;br /&gt;
    {&lt;br /&gt;
        public event PropertyChangedEventHandler PropertyChanged;&lt;br /&gt;
&lt;br /&gt;
        protected void NotifyPropertyChanged(string propertyName)&lt;br /&gt;
        {&lt;br /&gt;
            if (PropertyChanged != null)&lt;br /&gt;
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;This is actually a pretty typical approach to handling
INotifyPropertyChanged. There are even more robust versions out
there which use lambdas and reflection to help avoid passing in
strings, but they ultimately come down to raising the
PropertyChanged event. Many of them also fail to work properly in
cross-thread situations.&lt;/p&gt;

&lt;p&gt;I expose the Customer class and a collection of customers from a
ViewModel class.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
namespace SilverlightThreadingExample.ViewModel&lt;br /&gt;
{&lt;br /&gt;
    public class CustomerEntryViewModel : Observable&lt;br /&gt;
    {&lt;br /&gt;
        private Customer _currentCustomer;&lt;br /&gt;
        public Customer CurrentCustomer&lt;br /&gt;
        {&lt;br /&gt;
            get { return _currentCustomer; }&lt;br /&gt;
            set { _currentCustomer = value; NotifyPropertyChanged("CurrentCustomer"); }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private ObservableCollection&amp;lt;Customer&amp;gt; _customers = new ObservableCollection&amp;lt;Customer&amp;gt;();&lt;br /&gt;
        public ObservableCollection&amp;lt;Customer&amp;gt; Customers&lt;br /&gt;
        {&lt;br /&gt;
            get { return _customers; }&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        public void LoadCustomersOnSameThread()&lt;br /&gt;
        {&lt;br /&gt;
            LoadDummyData();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        private void LoadDummyData()&lt;br /&gt;
        {&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Pete" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Jon" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Tim" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Scott" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Andy" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Blaine" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Jesse" });&lt;br /&gt;
            _customers.Add(new Customer() { FirstName = "Rey" });&lt;br /&gt;
&lt;br /&gt;
            _currentCustomer = _customers[0];&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Finally, the UI is bound to those classes. The DataContext for
the UI (which will be set in code-behind) is the ViewModel.&lt;/p&gt;

&lt;pre class="brush: xml;"&gt;
&amp;lt;UserControl x:Class="SilverlightThreadingExample.MainPage"&lt;br /&gt;
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br /&gt;
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"&lt;br /&gt;
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"&lt;br /&gt;
    mc:Ignorable="d"&lt;br /&gt;
    d:DesignHeight="400" d:DesignWidth="600"&amp;gt;&lt;br /&gt;
&lt;br /&gt;
    &amp;lt;Grid x:Name="LayoutRoot" Background="White"&amp;gt;&lt;br /&gt;
        &amp;lt;Grid Width="500"&amp;gt;&lt;br /&gt;
            &amp;lt;Grid.ColumnDefinitions&amp;gt;&lt;br /&gt;
                &amp;lt;ColumnDefinition Width="*" /&amp;gt;&lt;br /&gt;
                &amp;lt;ColumnDefinition Width="250" /&amp;gt;&lt;br /&gt;
            &amp;lt;/Grid.ColumnDefinitions&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;ListBox x:Name="CustomerList"&lt;br /&gt;
                     Grid.Column="0" Margin="10"&lt;br /&gt;
                     ItemsSource="{Binding Customers}"&lt;br /&gt;
                     SelectedItem="{Binding CurrentCustomer, Mode=TwoWay}"&amp;gt;&lt;br /&gt;
                &amp;lt;ListBox.ItemTemplate&amp;gt;&lt;br /&gt;
                    &amp;lt;DataTemplate&amp;gt;&lt;br /&gt;
                        &amp;lt;TextBlock Text="{Binding FirstName}" /&amp;gt;&lt;br /&gt;
                    &amp;lt;/DataTemplate&amp;gt;&lt;br /&gt;
                &amp;lt;/ListBox.ItemTemplate&amp;gt;&lt;br /&gt;
            &amp;lt;/ListBox&amp;gt;&lt;br /&gt;
&lt;br /&gt;
            &amp;lt;StackPanel Grid.Column="1"&amp;gt;&lt;br /&gt;
                &amp;lt;TextBox x:Name="FirstNameField" Margin="10"&lt;br /&gt;
                         DataContext="{Binding CurrentCustomer}"&lt;br /&gt;
                         Text="{Binding FirstName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
                &amp;lt;Button x:Name="AddCustomer"&lt;br /&gt;
                        Content="Add Customer from UI Thread"&lt;br /&gt;
                        Height="30" Margin="5"&lt;br /&gt;
                        Click="AddCustomer_Click" /&amp;gt;&lt;br /&gt;
                &amp;lt;Button x:Name="AddCustomerSecond"&lt;br /&gt;
                        Content="Add Customer from Second Thread"&lt;br /&gt;
                        Height="30" Margin="5"&lt;br /&gt;
                        Click="AddCustomerSecond_Click" /&amp;gt;&lt;br /&gt;
                &amp;lt;Button x:Name="ChangeNameFromSecondThread"&lt;br /&gt;
                        Content="Change Name from Second Thread"&lt;br /&gt;
                        Height="30" Margin="5"&lt;br /&gt;
                        Click="ChangeNameFromSecondThread_Click" /&amp;gt;&lt;br /&gt;
            &amp;lt;/StackPanel&amp;gt;&lt;br /&gt;
&lt;br /&gt;
        &amp;lt;/Grid&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;/Grid&amp;gt;&lt;br /&gt;
&amp;lt;/UserControl&amp;gt;
&lt;/pre&gt;

&lt;p&gt;The code-behind looks like this&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
using System.Windows;&lt;br /&gt;
using System.Windows.Controls;&lt;br /&gt;
using SilverlightThreadingExample.ViewModel;&lt;br /&gt;
using System.Threading;&lt;br /&gt;
using SilverlightThreadingExample.Model;&lt;br /&gt;
&lt;br /&gt;
namespace SilverlightThreadingExample&lt;br /&gt;
{&lt;br /&gt;
    public partial class MainPage : UserControl&lt;br /&gt;
    {&lt;br /&gt;
        CustomerEntryViewModel _vm;&lt;br /&gt;
&lt;br /&gt;
        public MainPage()&lt;br /&gt;
        {&lt;br /&gt;
            InitializeComponent();&lt;br /&gt;
&lt;br /&gt;
            CreateViewModelOnUIThread();&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private void CreateViewModelOnUIThread()&lt;br /&gt;
        {&lt;br /&gt;
            _vm = new CustomerEntryViewModel();&lt;br /&gt;
&lt;br /&gt;
            _vm.LoadCustomersOnSameThread();&lt;br /&gt;
&lt;br /&gt;
            DataContext = _vm;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private void AddCustomer_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private void AddCustomerSecond_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
        private void ChangeNameFromSecondThread_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
        {&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&lt;/pre&gt;

&lt;p&gt;The methods are named to keep the context clear in this example.
I wouldn't expect you to name your VM instantiation/locator method
"CreateViewModelOnUIThread", for example.&lt;/p&gt;

&lt;p&gt;Now let's look at those scenarios.&lt;/p&gt;

&lt;h4&gt;Changing a property value from a background thread&lt;/h4&gt;

&lt;p&gt;Often in an application, you have a class which is used in UI
binding (an entity/model object) but still need to modify a
property from code. Sometimes, you need to do that from a
background thread. For example, you make a network call to get an
updated price for an item. You will get a cross-thread access error
when the class raises change notification events from that property
setter. If the class is truly POCO (Plan Old CLR Object) and
doesn't do any change notification or other event raising, you'll
be fine. If, however, change notification is involved, you'll get
the cross-thread exception.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/82277/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_13.png" width="640" height="261" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;p&gt;Assuming the same Customer and Observable classes defined above,
and the same XAML UI, the following code in the code-behind will
throw that exception.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void ChangeNameFromSecondThread_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Thread t = new Thread((o) =&amp;gt;&lt;br /&gt;
        {&lt;br /&gt;
            _vm.CurrentCustomer.FirstName = "UpdatedFromSecondThread";&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
    t.Start();&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The exception doesn't happen when you set the property value;
that's perfectly acceptable. It happens here, at the highlighted
line:&lt;/p&gt;

&lt;pre class="brush: csharp; highlight: [4];"&gt;
protected void NotifyPropertyChanged(string propertyName)&lt;br /&gt;
{&lt;br /&gt;
    if (PropertyChanged != null)&lt;br /&gt;
        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;So, what are the options for working around this? Let's consider
two common approaches.&lt;/p&gt;

&lt;h5&gt;Approach 1&lt;/h5&gt;

&lt;p&gt;The first approach is to do the whole property change from the
UI thread. To do this, simply wrap the property set code with a
call to the dispatcher. You can use either the Dispatcher object,
or if you keep a copy of the SynchronizationContext around, use
that.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/82282/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_22.png" width="640" height="261" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;p&gt;Here's some example code which implements this. The code looks a
bit silly because I'm forcing a background thread. However, pretend
that the background thread is a given and you need to work from it
(again, the callback from a network call or something.)&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void ChangeNameFromSecondThread_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Thread t = new Thread((o) =&amp;gt;&lt;br /&gt;
    {&lt;br /&gt;
        Deployment.Current.Dispatcher.BeginInvoke(() =&amp;gt;&lt;br /&gt;
            {&lt;br /&gt;
                _vm.CurrentCustomer.FirstName = "UpdatedFromSecondThread";&lt;br /&gt;
            });&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    t.Start();&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;This approach works well, but requires the calling code to
handle all the dispatching. If you have a number of properties to
change in different bits of code, it gets a bit cumbersome. Let's
look at another approach.&lt;/p&gt;

&lt;h5&gt;Approach 2&lt;/h5&gt;

&lt;p&gt;The real problem is the property change notification, so the the
second approach is to dispatch just the change notification to the
UI thread.&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/82287/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_24.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/82292/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_thumb_8.png" width="640" height="261" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can put this code into the Observable base class in order to
avoid repeating it throughout all your classes.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
// Code-behind&lt;br /&gt;
// ----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// this version throws an exception if the Observable base class isn't doing thread checking&lt;br /&gt;
private void ChangeNameFromSecondThread_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Thread t = new Thread((o) =&amp;gt;&lt;br /&gt;
        {&lt;br /&gt;
            _vm.CurrentCustomer.FirstName = "UpdatedFromSecondThread";&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
    t.Start();&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// Observable&lt;br /&gt;
// ----------------------------------------------&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
using System.ComponentModel;&lt;br /&gt;
using System.Windows;&lt;br /&gt;
&lt;br /&gt;
namespace SilverlightThreadingExample&lt;br /&gt;
{&lt;br /&gt;
    public class Observable : INotifyPropertyChanged&lt;br /&gt;
    {&lt;br /&gt;
        public event PropertyChangedEventHandler PropertyChanged;&lt;br /&gt;
&lt;br /&gt;
        protected void NotifyPropertyChanged(string propertyName)&lt;br /&gt;
        {&lt;br /&gt;
            if (PropertyChanged != null)&lt;br /&gt;
            {&lt;br /&gt;
                if (Deployment.Current.Dispatcher.CheckAccess())&lt;br /&gt;
                {&lt;br /&gt;
                    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));&lt;br /&gt;
                }&lt;br /&gt;
                else&lt;br /&gt;
                {&lt;br /&gt;
                    Deployment.Current.Dispatcher.BeginInvoke(() =&amp;gt;&lt;br /&gt;
                    {&lt;br /&gt;
                        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));&lt;br /&gt;
                    });&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Note how I first check to see if we have access to the UI thread
using the CheckAccess call. If we do, there's no reason to incur
the overhead and delay of a dispatcher call. However, if we are
running on the background thread, then the call is dispatched to
the UI thread. In either case, we avoid the errors cause by
cross-thread property change notification.&lt;/p&gt;

&lt;p&gt;Next up: Collections&lt;/p&gt;

&lt;h4&gt;Populating an ObservableCollection from a networking return
call&lt;/h4&gt;

&lt;p&gt;A more robust Observable base class like this won't help with
collection change notification (WPF 4.5 has a great solution for
that using BindingOperations.EnableCollectionSynchronization, but
unfortunately Silverlight does not).&lt;/p&gt;

&lt;p&gt;Most applications make networking calls to get information from
some resource on an intranet or out on the web. In Silverlight (and
WPF), it's common practice to populate an ObservableCollection with
the results from those calls. The ObservableCollection class is
nice because it implements INotifyCollectionChanged and raises an
event whenever items are added to or deleted from the collection,
or when the collection is cleared. It's this notification that
enables the various items controls and grids in the UI to stay in
sync with the items in the collection.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/82297/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_16.png" width="640" height="261" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;p&gt;This version is very similar to what we saw with individual
properties earlier. That's because, it's really the same problem:
we're trying to notify the binding system across threads.&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void AddCustomerSecond_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    Thread t = new Thread((o) =&amp;gt;&lt;br /&gt;
    {&lt;br /&gt;
        var cust = new Customer() { FirstName = "AddedFromSecondThread" };&lt;br /&gt;
        _vm.Customers.Add(cust);&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    t.Start();&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;Note that the problem exists regardless of where you actually
create the customer. For example, this code will also fail:&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void AddCustomerSecond_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    var cust = new Customer() { FirstName = "AddedFromSecondThread" };&lt;br /&gt;
&lt;br /&gt;
    Thread t = new Thread((o) =&amp;gt;&lt;br /&gt;
    {&lt;br /&gt;
        _vm.Customers.Add(cust);&lt;br /&gt;
    });&lt;br /&gt;
&lt;br /&gt;
    t.Start();&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;The reason is, again, it's not the object access that is causing
the cross-thread exception, it's the collection changed
notification that's full of hate here.&lt;/p&gt;

&lt;p&gt;So, how do you get around this? Unless you want to create your
own ObservableCollection type class for Silverlight, you'll need to
dispatch all collection add calls. Luckily, you'll typically have
fewer of these scattered throughout the application, so it's not
quite so onerous.&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/82302/Windows-Live-Writer_Threading-Considerations-for-Binding-in-_EF97_image_27.png" width="640" height="261" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;p&gt;The code to implement this is just another easy call to the
dispatcher (or SynchronizationContext, if you prefer).&lt;/p&gt;

&lt;pre class="brush: csharp;"&gt;
private void AddCustomerSecond_Click(object sender, RoutedEventArgs e)&lt;br /&gt;
{&lt;br /&gt;
    // you can create customer on any thread&lt;br /&gt;
    var cust = new Customer() { FirstName = "AddedFromSecondThread" };&lt;br /&gt;
&lt;br /&gt;
    Thread t = new Thread((o) =&amp;gt;&lt;br /&gt;
        {&lt;br /&gt;
&lt;br /&gt;
            // dispatch to UI thread to add it to the collection. You can't&lt;br /&gt;
            // access the observable collection x-thread&lt;br /&gt;
            Deployment.Current.Dispatcher.BeginInvoke(() =&amp;gt;&lt;br /&gt;
                {&lt;br /&gt;
                    _vm.Customers.Add(cust);&lt;br /&gt;
                });&lt;br /&gt;
        });&lt;br /&gt;
&lt;br /&gt;
    t.Start();&lt;br /&gt;
}
&lt;/pre&gt;

&lt;p&gt;If you're going to run from an unknown state, be sure to call
CheckAccess to see if you really need to do the dispatching. In
this case, I know I'm always going to be on a background thread, so
I don't bother.&lt;/p&gt;

&lt;h3&gt;Summary&lt;/h3&gt;

&lt;p&gt;The intent here was to show a few of the common threading
pitfalls in Silverlight (and WPF) applications, specifically in the
context of change notification. In most code, it's easy to tell
when you're accessing objects cross-thread, but change notification
is a somewhat behind the scenes operation, so it's not always
obvious.&lt;/p&gt;

&lt;p&gt;For property change notification, the solutions were:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dispatch the entire property change operation to the UI
thread&lt;/li&gt;

&lt;li&gt;Update the NotifyPropertyChanged code to check to see which
thread it's running on, and then dispatch the event as
appropriate&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Either way works, but I prefer the update to the
NotifyPropertyChanged method.&lt;/p&gt;

&lt;p&gt;For collection change notifications in Silverlight, the
solutions are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create (or find) an implementation of ObservableCollection
which does the cross-thread checking. The reason this isn't
built-in is change notification happens often, and dispatching each
and every change notification can be a real performance drain.
That's also why WPF has a separate and optimized solution. You'd
need to enable batching to avoid the overhead of hundreds of
dispatch calls.&lt;/li&gt;

&lt;li&gt;Dispatch the entire collection update when you're running on a
background thread.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In contrast to the property change notifications, for collection
change, I prefer to dispatch the entire call. If you're adding 1
object or 100, you'll still get only one dispatch call, so
performance is better.&lt;/p&gt;

&lt;p&gt;The Task Parallel Library in WPF, and the subset of it in
Silverlight also offer some alternative approaches to handling
cross-thread work. Similarly, the async and await keywords in .NET
4.5 and Windows 8 XAML can also come into play. More on those in
the future.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fNpx-ibznhybKF2eEgX79WjYDaE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fNpx-ibznhybKF2eEgX79WjYDaE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/fNpx-ibznhybKF2eEgX79WjYDaE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fNpx-ibznhybKF2eEgX79WjYDaE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/mPgdkOol8xE" height="1" width="1"/&gt;</description></item><item><title>Silverlight Reporting Open Source Printing/Reports Example Updated for Silverlight 5</title><author>Pete Brown	</author><link>http://10rem.net/blog/2012/01/09/silverlight-reporting-open-source-printing-reports-example-updated-for-silverlight-5</link><pubDate>Mon, 09 Jan 2012 20:44:30 GMT</pubDate><guid>http://10rem.net/blog/2012/01/09/silverlight-reporting-open-source-printing-reports-example-updated-for-silverlight-5</guid><description>&lt;p&gt;I recently posted an updated version of Silverlight reporting on
&lt;a href="http://silverlightreporting.codeplex.com/"
target="_blank"&gt;codeplex&lt;/a&gt;. Here's the overview.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://silverlightreporting.codeplex.com/"
target="_blank"&gt;&lt;img src="http://10rem.net/media/82245/Windows-Live-Writer_Silverlight-Reporting-Open-Source-Printi_EA02_image_5.png" width="490" height="100" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This project, a unofficial project by Pete Brown of Microsoft,
provides a a very basic framework for building simple, short,
multi-page reports using Silverlight 5.&lt;/p&gt;

&lt;p&gt;The intent is not to be an all-encompassing reporting solution,
or a solution for large reports. Instead, this is a set of code you
can build upon to create short (2-5 page) reports from your
Silverlight applications.&lt;/p&gt;

&lt;p&gt;Currently the sample consists of the full source code of a
simple report writer. It includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;automatic pagination&lt;/li&gt;

&lt;li&gt;support for line items of varying height&lt;/li&gt;

&lt;li&gt;total page count&lt;/li&gt;

&lt;li&gt;templating&lt;/li&gt;

&lt;li&gt;page headers and footers&lt;/li&gt;

&lt;li&gt;report footer with support for calculated fields&lt;/li&gt;

&lt;li&gt;events to allow hooking into printing at various stages&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Latest Release&lt;/h3&gt;

&lt;p&gt;Version information changed to use semantic versioning. This
vesion is numbered: &lt;a
href="http://silverlightreporting.codeplex.com/releases/view/80092"
target="_blank"&gt;1.0.0-alpha.3&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now targets Silverlight 5&lt;/li&gt;

&lt;li&gt;Added ability to specify postscript (vector) printing. The
selected driver must support PostScript or this setting will have
no effect.&lt;/li&gt;

&lt;li&gt;Fixed issue with not being able to re-print the report. (and
fixed leaky event handlers)&lt;/li&gt;

&lt;li&gt;Added null check on templates&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="http://silverlightreporting.codeplex.com/"
target="_blank"&gt;&lt;img src="http://10rem.net/media/82250/Windows-Live-Writer_Silverlight-Reporting-Open-Source-Printi_EA02_image_6.png" width="366" height="468" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is still alpha, and is a minor project. Expect bugs. Report
them when you do. Offer fixes if you can :)&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://silverlightreporting.codeplex.com/releases/view/80092"
target="_blank"&gt;Get the latest release here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ltWkyhytsE8DRleqvgYuDsugFjk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ltWkyhytsE8DRleqvgYuDsugFjk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ltWkyhytsE8DRleqvgYuDsugFjk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ltWkyhytsE8DRleqvgYuDsugFjk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/9lvuBR5MsTc" height="1" width="1"/&gt;</description></item><item><title>Slides and Code from my VSLive Silverlight 5, REST, WCF Web API, MVC talk</title><author>Pete Brown	</author><link>http://10rem.net/blog/2011/12/15/slides-and-code-from-my-vslive-silverlight-5-rest-wcf-web-api-mvc-talk</link><pubDate>Thu, 15 Dec 2011 21:13:05 GMT</pubDate><guid>http://10rem.net/blog/2011/12/15/slides-and-code-from-my-vslive-silverlight-5-rest-wcf-web-api-mvc-talk</guid><description>&lt;p&gt;This talk was an adaptation of two chapters from Silverlight 5
in Action. I started with a brief explanation of REST, and then
explained the solution we were going to build during the session.
The idea was to show how you can use REST in place of the heavier
Soap approach in many cases, and make your services accessible to
far more clients.&lt;/p&gt;

&lt;p&gt;I also showed how to share model objects between various
implementations of .NET, using linked files and conditional
compilation.&lt;/p&gt;

&lt;p&gt;Without watching the session or reading the chapters, the source
and slides are only somewhat useful as you miss the interim steps.
So, if you happen to be at an event where I deliver this again
(I've submitted it to several upcoming 2012 events), great. If
not…&lt;a href="http://www.manning.com/pbrown2/" target="_blank"&gt;buy
my Silverlight 5 book&lt;/a&gt; ;)&lt;/p&gt;

&lt;p&gt;&lt;img src="http://10rem.net/media/81420/Windows-Live-Writer_cb379422aa67_EC67_image_3.png" width="520" height="394" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In addition to what's covered in my book, I also &lt;a
href="http://10rem.net/blog/2011/08/01/creating-a-silverlight-5-helper-for-aspnet-mvc3-razor"
 target="_blank"&gt;showed how to create a basic Razor Helper to load
Silverlight in the page&lt;/a&gt;. You can learn more at the linked blog
post.&lt;/li&gt;

&lt;li&gt;The WCF Web API may be found at the &lt;a
href="http://wcf.codeplex.com/" target="_blank"&gt;WCF CodePlex
Site&lt;/a&gt;.&lt;/li&gt;

&lt;li&gt;You can learn (a lot) more about ASP.NET MVC at our &lt;a
href="http://asp.net/" target="_blank"&gt;ASP.NET Community
Site&lt;/a&gt;.&lt;/li&gt;

&lt;li&gt;Of course, you can get all the Silverlight 5 bits at our &lt;a
href="http://silverlight.net/" target="_blank"&gt;Silverlight
Community Site&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything else is attached to this blog post. The zip file is
around 7mb.&lt;/p&gt;

&lt;p&gt;Feel free to present this at your own internal or public events.
I only ask that you not submit this as a session at VSLive, TechEd,
DevConnections or other large events where I may be planning to
present. When in doubt, ask.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/gev81N_NmZnROGGHk-9RHs4ESQs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gev81N_NmZnROGGHk-9RHs4ESQs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/gev81N_NmZnROGGHk-9RHs4ESQs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/gev81N_NmZnROGGHk-9RHs4ESQs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/pkCoMdUor7M" height="1" width="1"/&gt;</description></item><item><title>Announcing the Release of Silverlight 5!</title><author>Pete Brown	</author><link>http://10rem.net/blog/2011/12/09/announcing-the-release-of-silverlight-5</link><pubDate>Fri, 09 Dec 2011 19:30:14 GMT</pubDate><guid>http://10rem.net/blog/2011/12/09/announcing-the-release-of-silverlight-5</guid><description>&lt;p&gt;&lt;a href="http://silverlight.net/downloads" target="_blank"&gt;&lt;img src="http://10rem.net/media/81398/Windows-Live-Writer_Announcing-the-Release-of-Silverlight-5_DE99_image_9.png" width="320" height="420" alt="Stocking by Squirrel Cottage http://www.flickr.com/photos/squirrel_cottage/3041480598/" border="0" style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Look what just came out, and well in time to beat the Christmas
rush :) Yes, it's Silverlight 5. We had originally announced that
Silverlight 5 would be out by the end of this year, and I'm glad to
report that it has made it in in time to give everyone something
interesting to play with over the holidays. My congratulations to
the engineering, marketing, support, and documentation teams for
pulling off yet another amazing release.&lt;/p&gt;

&lt;h3&gt;Get the Bits&lt;/h3&gt;

&lt;p&gt;The best place to go to get the bits is &lt;a
href="http://silverlight.net/downloads"&gt;http://silverlight.net/downloads&lt;/a&gt;
. Make sure you have Visual Studio 2010 SP1 (or Visual Web
Developer) and then install the Silverlight 5 Tools. While there,
be sure to install the latest version of the Silverlight 5 Toolkit
- most of the XNA goodness is in the toolkit and SDK.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://silverlight.net/downloads" target="_blank"&gt;&lt;img src="http://10rem.net/media/81403/Windows-Live-Writer_Announcing-the-Release-of-Silverlight-5_DE99_image_6.png" width="520" height="233" alt="image" border="0" style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The version number for this release of Silverlight 5 is
5.0.61118. You can in-place upgrade from the RC. While not
required, you can also uninstall the old bits first if you
want.&lt;/p&gt;

&lt;h3&gt;Where to Get Help&lt;/h3&gt;

&lt;p&gt;The &lt;a href="http://www.silverlight.net/learn"&gt;Learn section on
Silverlight.net&lt;/a&gt; is the primary location for Silverlight 5
videos and tutorials. The beta and RC content still applies, and
I've started creating more Release content for you as well.&lt;/p&gt;

&lt;p&gt;We have a dedicated &lt;a
href="http://forums.silverlight.net/"&gt;Silverlight 5 forum&lt;/a&gt; on
Silverlight.net. Post any Silverlight 5-related technical questions
there for peer support.&lt;/p&gt;

&lt;p&gt;Of course, I can't help but throw out a plug for my book &lt;a
href="http://manning.com/pbrown2"&gt;Silverlight 5 in Action&lt;/a&gt;. If
you order it right now, you get the early access bits, which is
1200 pages of raw unedited writing from me. I think you'll like
it.&lt;/p&gt;

&lt;h3&gt;Silverlight 5 RTM/RTW Features&lt;/h3&gt;

&lt;p&gt;Silverlight 5 adds a ton of new features over what we had with
Silverlight 4. These are non-trivial features like a full 3d stack,
parsing performance improvements, tons of enhancements to binding
and much more. My favorite features have to be Implicit Templates
and the XNA-Compatible 3d Stack. The &lt;a
href="http://go.microsoft.com/fwlink/?LinkId=229308"
target="_blank"&gt;official list of features is here&lt;/a&gt;, but I've
also detailed some below with direct links to learning content
(this is adapted from my RC post).&lt;/p&gt;

&lt;h4&gt;Binding and Related&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;ICustomTypeProvider (see &lt;a
href="http://blogs.msdn.com/b/silverlight_sdk/archive/2011/04/26/binding-to-dynamic-properties-with-icustomtypeprovider-silverlight-5-beta.aspx"&gt;
Alexandra Rusina's post&lt;/a&gt;)&lt;/li&gt;

&lt;li&gt;Custom Markup Extensions&lt;/li&gt;

&lt;li&gt;Ancestor RelativeSource Binding&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-working-with-implicit-templates"&gt;
Implicit Data Templates&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Binding in Style Setters&lt;/li&gt;

&lt;li&gt;DataContextChanged Event&lt;/li&gt;

&lt;li&gt;PropertyChanged now an UpdateSourceTrigger option&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Graphics&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;XNA 3D API&lt;/li&gt;

&lt;li&gt;Improved Graphics Stack&lt;/li&gt;

&lt;li&gt;XNA 3D built-in effects&lt;/li&gt;

&lt;li&gt;XNA 3D Project Templates with full XNA Content Pipeline&lt;/li&gt;

&lt;li&gt;3D surface composition settings&lt;/li&gt;

&lt;li&gt;3D multi-sample anti-aliasing&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Media&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-using-the-soundeffect-class-for-low-latency-sound-and-play-wav-files-in-silverlight"&gt;
Low-Latency Sound using XNA SoundEffect and
SoundEffectInstance&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Hardware decoding of unprotected H.264 media&lt;/li&gt;

&lt;li&gt;Variable Speed Playback and Trick-play (new since beta)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/08/31/silverlight-5-remote-control-and-mediacommand-support"&gt;
Remote Control and Media Command (Keys) Support&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Text&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-advancements-in-text"&gt;
Text Tracking and Leading&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-advancements-in-text"&gt;
Linked and Multi-column Text&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/09/02/silverlight-5-and-wpf-4-opentype-support"&gt;
OpenType Support&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/09/02/silverlight-5-text-clarity-and-pixel-snapping"&gt;
Pixel Snapped Text and TextOptions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Operating System Integration&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/09/20/enumerating-midi-interfaces-using-silverlight-5-pinvoke"&gt;
P/Invoke&lt;/a&gt;&amp;nbsp; (also: &lt;a
href="http://10rem.net/blog/2011/09/27/enumerating-printers-using-pinvoke-in-silverlight-5"&gt;
My Printer Enum Example&lt;/a&gt;)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-working-with-operating-system-windows"&gt;
Multiple Windows&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Unrestricted File System Access in Full Trust&lt;/li&gt;

&lt;li&gt;Full Trust in-browser for enterprise scenarios&lt;/li&gt;

&lt;li&gt;Default Filename in SaveFileDialog and OpenFileDialog&lt;/li&gt;

&lt;li&gt;64 bit browser support for Windows&lt;/li&gt;

&lt;li&gt;Power awareness for media apps (keep the PC alive while a movie
is playing, for example)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Productivity and Performance&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Network Latency Improvements&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-debugging-bindings-with-xaml-breakpoints"&gt;
Databinding Debugging&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;Parser Performance Improvements&lt;/li&gt;

&lt;li&gt;Multi-core JIT for improved start-up time&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Controls&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/04/13/silverlight-5-supporting-double-and-even-triple-click-for-the-mouse"&gt;
Double and n-click support&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;PivotViewer (with improved customization and more)&lt;/li&gt;

&lt;li&gt;ComboBox type-ahead/incremental search&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Other&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;In-browser HTML for trusted in-browser applications&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/06/11/silverlight-5-vector-and-bitmap-printing-for-reports-and-more"&gt;
PostScript Vector Printing&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://10rem.net/blog/2011/09/04/simplifying-async-networking-with-tasks-in-silverlight-5"&gt;
Tasks from TPL&lt;/a&gt;&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/csharpfaq/archive/2010/02/16/covariance-and-contravariance-faq.aspx"&gt;
C# Covariance and Contravariance&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and more…&lt;/p&gt;

&lt;h3&gt;My Silverlight CodePlex Projects&lt;/h3&gt;

&lt;p&gt;For a number of reasons, I've let my CodePlex projects sit for a
bit. The time has come for me to finally update them. I'll have new
Silverlight 5 versions of the &lt;a
href="http://silverlightc64.codeplex.com/"
target="_blank"&gt;Commodore 64 Emulator&lt;/a&gt; with a new UI and sound
support, and the &lt;a
href="http://silverlightreporting.codeplex.com/"
target="_blank"&gt;Silverlight Printing/Reporting example&lt;/a&gt; both up
shortly after I return from vacation with the family. Look for more
info soon.&lt;/p&gt;

&lt;h3&gt;Go Get it&lt;/h3&gt;

&lt;p&gt;So go and &lt;a href="http://silverlight.net/downloads"
target="_blank"&gt;check out the release&lt;/a&gt;. It is backwards
compatible with your Silverlight 4 applications (it runs in quirks
mode until you recompile the project for Silverlight 4), so feel
free to target SL3, 4 or 5 using the Silverlight 5 bits.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/R0fTJudefVEQHxks0R1nBO_Kcnc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R0fTJudefVEQHxks0R1nBO_Kcnc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/R0fTJudefVEQHxks0R1nBO_Kcnc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/R0fTJudefVEQHxks0R1nBO_Kcnc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/IVmqMCgBuH8" height="1" width="1"/&gt;</description></item><item><title>Windows Client Developer Roundup 085 for 11/28/2011</title><author>Pete Brown	</author><link>http://10rem.net/blog/2011/11/28/windows-client-developer-roundup-085-for-11-28-2011</link><pubDate>Mon, 28 Nov 2011 04:03:08 GMT</pubDate><guid>http://10rem.net/blog/2011/11/28/windows-client-developer-roundup-085-for-11-28-2011</guid><description>&lt;p&gt;The Windows Client Developer Roundup aggregates information of
interest to Windows Client Developers, including &lt;a
href="http://dev.windows.com/"&gt;WinRT XAML&lt;/a&gt;, &lt;a
href="http://windowsclient.net/"&gt;WPF&lt;/a&gt;, &lt;a
href="http://silverlight.net/"&gt;Silverlight&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/visualc/default.aspx"&gt;Visual
C++&lt;/a&gt;, &lt;a href="http://creators.xna.com/"&gt;XNA&lt;/a&gt;, &lt;a
href="http://expression.microsoft.com/"&gt;Expression Blend&lt;/a&gt;, &lt;a
href="http://www.microsoft.com/surface/"&gt;Surface&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/windows/default.aspx"&gt;Windows
7&lt;/a&gt;, &lt;a
href="http://msdn.microsoft.com/en-us/ff380145.aspx"&gt;Windows
Phone&lt;/a&gt;, Visual Studio, &lt;a
href="http://silverlight.net/riaservices/"&gt;WCF RIA Services&lt;/a&gt; and
more. Sometimes I even include a little jQuery and HTML5. If you
have something interesting you've done or have run across, or you
blog regularly on the topics included here, please send me the URL
and brief description via the &lt;a href="http://10rem.net/contact"&gt;contact
link&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Note that I've started breaking the Netduino, Electronics,
Robotics, Synthesizer and similar content into a new roundup series
called the &lt;a href="http://10rem.net/blog?filterby=MakerRoundup"&gt;Maker Geek
Roundup&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Shout-Outs&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://mottishaked.com/training/dot-net-tutorial"&gt;.NET
Tutorial: Learn .NET and C# interactively&lt;/a&gt; (Motti Shaked)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2011/11/24/10241128.aspx"&gt;
Announcing GoingNative 2012 Conference&lt;/a&gt; (Visual C++ Team
Blog)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Windows 8 and WinRT/Metro General&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2011/10/31/10231530.aspx"&gt;
Try It Now: Use PPL to Produce Windows 8 Asynchronous
Operations&lt;/a&gt; (Visual C++ Team Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/visualstudio/archive/2011/11/01/debugging-contracts-using-windows-simulator.aspx"&gt;
Debugging Contracts using Windows Simulator&lt;/a&gt; (Visual Studio
Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/seealso/archive/2011/10/14/handling-orientation-changes-and-setting-preferred-orientation-in-metro-style-apps.aspx"&gt;
Handling orientation changes and setting preferred orientation in
Metro style apps&lt;/a&gt; (Gus Class)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://michaelcrump.net/archive/2011/11/25/1360x768x32-resolution-in-windows-8-in-virtualbox.aspx"&gt;
1360x768x32 Resolution in Windows 8 in VirtualBox&lt;/a&gt; (Michael
Crump)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;XAML Technologies (Silverlight, WPF, WinRT Metro XAML)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blog.quppa.net/2011/10/24/windows-theme-fonts-redux-sample-code/"&gt;
Windows Theme Fonts Redux &amp;amp; Sample Code&lt;/a&gt; (Quppa's Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.jonathanantoine.com/2011/11/24/wpf-4-5-%e2%80%93-part-13-binding-to-types-that-implement-icustomtypeprovider-2/"&gt;
WPF 4.5 - Part 13 : binding to types that Implement
ICustomTypeProvider&lt;/a&gt; (Jonathan Antoine)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://michaelcrump.net/archive/2011/10/12/adding-an-application-bar-to-your-xaml-metro-applications.aspx"&gt;
Adding an Application Bar to your XAML Metro Applications.&lt;/a&gt;
(Michael Crump)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.scottlogic.co.uk/blog/colin/2011/11/an-introduction-to-semantic-zoom-in-windows-8-metro/"&gt;
An Introduction to Semantic Zoom in Windows 8 Metro&lt;/a&gt; (Colin
Eberhardt)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://csharperimage.jeremylikness.com/2011/11/handling-extremely-large-data-sets-in.html"&gt;
Handling Extremely Large Data Sets in Silverlight&lt;/a&gt; (Jeremy
Likness)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Direct X Technologies (DirectX, XNA, WinRT DirectX, General GPU
and Game Programming)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2011/11/08/10235150.aspx"&gt;
Game Debugging in Visual Studio 11&lt;/a&gt; (Visual C++ Team Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/shawnhar/archive/2011/11/07/stand-still-and-they-won-t-see-you.aspx"&gt;
Stand still and they won't see you&lt;/a&gt; (Shawn Hargreaves)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/rezanour/archive/2011/11/20/math-primer-series-matrices-iii-affine-transformations-and-matrices.aspx"&gt;
Math Primer Series: Matrices III: Affine Transformations and
Matrices&lt;/a&gt; (Reza Nourai)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/shawnhar/archive/2011/11/18/temporal-sampling-frequency-aka-framerate.aspx"&gt;
Temporal sampling frequency (aka 'framerate')&lt;/a&gt; (Shawn
Hargreaves)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://jcoluna.wordpress.com/2011/11/17/xna-light-pre-pass-instancing/"&gt;
XNA Light Pre-Pass: Instancing&lt;/a&gt; (J. Coluna)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;C++ and Native Development&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2011/10/20/10228473.aspx"&gt;
Inside the C++/CX Design&lt;/a&gt; (Visual C++ Team Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/vcblog/archive/2011/10/31/10231784.aspx"&gt;
GoingNative 3: Marian Luparu answers about C++/CX&lt;/a&gt; (Visual C++
Team Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.blogmfc.com/n2011/11/09/c-code-analysis-in-visual-studio-2012/"&gt;
C++ code analysis in Visual Studio 2012&lt;/a&gt; (BlogMFC)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Visual Studio and .NET General&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/somasegar/archive/2011/11/17/visual-studio-11-ide-advances.aspx"&gt;
Visual Studio 11 IDE Advances&lt;/a&gt; (Soma)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;NUI (Kinect, Surface, More)&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://apeoholic.se/post/Our-Kinect-Controlled-livingroom.aspx"&gt;
Our Kinect Controlled living room&lt;/a&gt; (Apeoholic's blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://kinecthacks.net/kinect-controlled-treadmill-and-robot-navigation/"&gt;
Kinect Controlled Treadmill and Robot Navigation&lt;/a&gt;
(KinectHacks)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://robrelyea.wordpress.com/2011/11/13/my-shift-from-wpf-xaml-to-kinect-for-windows/"&gt;
My shift from WPF-XAML to Kinect for Windows&lt;/a&gt; (Rob Relyea)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://michaelcrump.net/archive/2011/11/14/information-on-upgrading-kinect-applications-to-ms-sdk-beta-2.aspx"&gt;
Information on upgrading Kinect Applications to MS SDK Beta 2.&lt;/a&gt;
(Michael Crump)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/surface/archive/2011/11/17/preorder.aspx"&gt;
Samsung SUR40 for Microsoft Surface Now Available for
Pre-order!&lt;/a&gt; (Surface Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://robrelyea.wordpress.com/2011/11/13/mobile-developers-and-kinect/"&gt;
Mobile developers and Kinect&lt;/a&gt; (Rob Relyea)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://blogs.msdn.com/b/surface/archive/2011/11/16/bown2011.aspx"&gt;
Samsung SUR40 for Microsoft Surface Receives "Best of What's New"
Award from Popular Science&lt;/a&gt; (Surface Blog)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://channel9.msdn.com/coding4fun/kinect/Kinect-with-your-Eclipse-IDE"&gt;
"Kinect with your Eclipse IDE"&lt;/a&gt; (Channel 9)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Off-Topic Fun&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a
href="http://www.smbc-comics.com/index.php?db=comics&amp;amp;id=2436"&gt;Graph
of Life Satisfaction for nerds vs. everyone else&lt;/a&gt; (SMBC)&lt;/li&gt;

&lt;li&gt;&lt;a
href="http://www.toxel.com/inspiration/2011/11/25/walkable-roller-coaster/"&gt;
Walkable Roller Coaster&lt;/a&gt; (Toxel) (Watch out for the loop!)&lt;/li&gt;

&lt;li&gt;&lt;a href="http://xkcd.com/981/"&gt;xkcd: P*rn Folder&lt;/a&gt;
(xkcd)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7EbbaIS5wfqienY2U3e9_Tgovjc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7EbbaIS5wfqienY2U3e9_Tgovjc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7EbbaIS5wfqienY2U3e9_Tgovjc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7EbbaIS5wfqienY2U3e9_Tgovjc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/BfUvejuqsKE" height="1" width="1"/&gt;</description></item><item><title>It’s a wrap! I’ve completed writing Silverlight 5 in Action</title><author>Pete Brown	</author><link>http://10rem.net/blog/2011/11/17/its-a-wrap-ive-completed-writing-silverlight-5-in-action</link><pubDate>Thu, 17 Nov 2011 07:51:07 GMT</pubDate><guid>http://10rem.net/blog/2011/11/17/its-a-wrap-ive-completed-writing-silverlight-5-in-action</guid><description>&lt;p&gt;Well, I've completed the initial writing anyway. Anyone who has
written a book understands the, umm, pleasure of the multiple
editing cycles which shall follow. I have my normal development
editor review Thursday afternoon, and then it's turned over for
tech review the following week. Tom is really going to have his
hands full with the 1191 pages this book came in at before editing
and production (which always reduces the page count by making
images smaller etc.)&lt;/p&gt;

&lt;p&gt;The last chapters I turned in were the two 3d chapters. I'm
really pleased with how they came out. It was a struggle to fit all
that 3d awesomeness in the 64 pages it took, but considering I had
budgeted only 25 pages total for 3d coverage, I can't really make
too much of a stink over that :)&lt;/p&gt;

&lt;p&gt;For those of you who remember the Commodore Amiga, you'll get a
kick out of the demo app we build across those two chapters:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/80440/Windows-Live-Writer_Silverlight-5-in-Action-is-all-wrapped-u_1875_image_8.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/80445/Windows-Live-Writer_Silverlight-5-in-Action-is-all-wrapped-u_1875_image_thumb_3.png" width="550" height="144" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yep. It's not a 100% reproduction (no sound or good simulated
physics), but it shows off modeling, texturing, cameras, matrices,
the rendering system, multiple ways of dealing with vertices and
triangles, and my own little keyframe animation system. Really cool
stuff, and tons of fun too.&lt;/p&gt;

&lt;p&gt;Here's the background of the original Amiga boing ball demo&lt;/p&gt;

&lt;div class="wlWriterEditableSmartContent"
id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:882ce760-e068-4a6e-80bc-7ca6a4bd2a0e"
 style="margin: 0px; display: inline; float: none; padding: 0px;"&gt;
&lt;div id="c01eca66-2895-4561-abb8-80435340248e"
style="margin: 0px; display: inline; padding: 0px;"&gt;&lt;embed
width="544" height="304"
src="http://www.youtube.com/v/cJcO628yCcU?hl=en&amp;amp;hd=1" /&gt;&lt;/div&gt;

&lt;div style="width: 544px; clear: both; font-size: 0.8em;"&gt;The
making of the Amiga Boing Ball demo&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Thank you to everyone who has already purchased Silverlight 5 in
Action. If you have yet picked up a copy, the Manning Early Access
Program (MEAP) still allows you to get the work-in-progress
chapters until the book is out in print. Go order it now and
support &lt;a href="http://thisdeveloperslife.com/post/2-0-6-play"
target="_blank"&gt;my electronics junkie habits&lt;/a&gt; :)&lt;/p&gt;

&lt;p&gt;Here's a taste (pre-editing) of what you can expect to find in
the second 3d chapter:&lt;/p&gt;

&lt;p&gt;&lt;a
href="http://10rem.net/media/80455/Windows-Live-Writer_Silverlight-5-in-Action-is-all-wrapped-u_1875_image_10.png"
 target="_blank"&gt;&lt;img src="http://10rem.net/media/80460/Windows-Live-Writer_Silverlight-5-in-Action-is-all-wrapped-u_1875_image_thumb_4.png" width="418" height="520" alt="image" border="0" style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px"/&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/E25STq03ihXn9XclllJ_4I8VFUU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/E25STq03ihXn9XclllJ_4I8VFUU/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/E25STq03ihXn9XclllJ_4I8VFUU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/E25STq03ihXn9XclllJ_4I8VFUU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/PeteBrown-Silverlight/~4/gQj-jfMuhPw" height="1" width="1"/&gt;</description></item></channel></rss>

