ScottGu Mix Keynote coding demo posted

A ton of folks have asked us about getting the source code to Scott’s cool coding demo. 


 Watch the demo

download the completed example code

Note, there are a couple of prereqs:

  1. Sql Server 2008 to run it.. works great with the free Sql Express 2008

  2. .NET RIA Services March '09 Preview

  3. Silverlight 3 Beta


Complete demo steps:

1. In Views/CustomersPage.xaml.cs, in OnNavigatedTo(), add the following:

var context = new CustomersDomainContext(); 
customersList.ItemsSource = context.Customers; 

This code loads the data from the DomainService class on the server.  Notice the data is loaded asynchronously, but no ugly, hard to debug async code is needed. 

2. In CustomerDetailsPage.xaml.cs OnNavigatedTo, add this code:

this.DataContext = context; 
int customerID = int.Parse(NavigationContext.QueryString["CustomerID"]); 


This code grabs the Customer id off the query string and loads it up.. effectively a detailsview.

3. F5 the app, click on one of the customers.

4. Then sign up for the SaveButton Click event (last line in the following XAML snippet):

<Button x:Name="SaveButton" 
Style="{StaticResource SaveButtonStyle}" 

5. In the code-behind CustomerDetailsPage.xaml.cs, add the following code to the newly-created event handler:

private void SaveButton_Click(object sender, RoutedEventArgs e) 

Notice how simple it is to save all your pending changes back to the server.  The client has kept up with what has changed and sends back a smart diff-gram.

6. Ctrl+F5 the app , go back to the details page, now try editing the phone number and see how it’s validated nicely. Note that this validation occurs both client-side and server-side.

7. Click one of the items in the DataGrid, show how the chart updates. Select something in another group in the DataGrid and show cool chart animation.

8. Click “Save” to save data in the DataForm back to the database.

Comments (19)

  1. Steve says:

    The link to Scott’s video demo does not seem to be working ??

  2. BradA says:

    thanks… i fixed it.

  3. Thank you for submitting this cool story – Trackback from DotNetShoutout

  4. In this Issue: Maurice de Beijer , Ruurd Boeke , Shawn Wildermuth , and Michael Wolf . Shoutouts: Brad

  5. DotNetBurner – burning hot .net content

  6. What's New says:

    A ton of folks have asked us about getting the source code to Scott’s cool coding demo. Watch the demo

  7. Thanks again to Marc Schweigert for hosting last night’s DevDinner in Reston. My blog is at

  8. I have previously written about the UNPLUGGED road trip that Mike , Nathan and I have been on. I also

  9. 話題の小向美奈子ストリップを盗撮!入念なボディチェックをすり抜けて超小型カメラで撮影した神動画がアップ中!期間限定配信の衝撃的映像を見逃すな

  10. 高額報酬 says:


  11. mixi says:


  12. 素人 says:


  13. メル友募集 says:

    最近してないし欲求不満です。一緒にいやらしいことしませんか?エッチには自信あるよ(笑) メール待ってるよ☆

  14. ホスト says:


  15. 家出 says:


  16. 動物占い says:


  17. 救援部 says:


  18. 家出 says:


Skip to main content