| By Brad Abrams | Article Rating: |
|
| April 30, 2009 03:00 PM EDT | Reads: |
1,294 |
A ton of folks have asked us about getting the source code to Scott’s cool coding demo.
download the completed example code
Note, there are a couple of prereqs:
- Sql Server 2008 to run it.. works great with the free Sql Express 2008
- .NET RIA Services March '09 Preview
- Silverlight 3 Beta
Enjoy!
Complete demo steps:
1. In Views/CustomersPage.xaml.cs, in OnNavigatedTo(), add the following:
var context = new CustomersDomainContext();
customersList.ItemsSource = context.Customers;
context.LoadCustomers();
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"]);
context.LoadCustomerOrders(customerID);
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}"
Click="SaveButton_Click"/>
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)
{
context.SubmitChanges();
}
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.
Published April 30, 2009 Reads 1,294
Copyright © 2009 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Brad Abrams
Brad Abrams is currently the Group Program Manager for the UI Framework and Services team at Microsoft which is responsible for delivering the developer platform that spans both client and web based applications, as well as the common services that are available to all applications. Specific technologies owned by this team include ASP.NET, Atlas and Windows Forms. He was a founding member of both the Common Language Runtime, and .NET Framework teams.
Brad has been designing parts of the .NET Framework since 1998 when he started his framework design career building the BCL (Base Class Library) that ships as a core part of the .NET Framework. He was also the lead editor on the Common Language Specification (CLS), the .NET Framework Design Guidelines, the libraries in the ECMA\ISO CLI Standard, and has been deeply involved with the WinFX and Windows Vista efforts from their beginning.
He co-authored Programming in the .NET Environment, and was editor on .NET Framework Standard Library Annotated Reference Vol 1 and Vol 2 and the Framework Design Guidelines.
- Microsoft’s First Step Toward Cloud Computing
- Adobe Flex Developer Earns $100K in New York City
- Jill T. Singer of CIA to Present at Cloud Computing Expo on November 2
- Visual Studio 2010 Is Cloud Friendly
- SplendidCRM for Microsoft Windows Azure
- Microsoft Falls Off Cliff, Keeps on Ticking
- Microsoft to Data-Mine Facebook & Twitter
- Amazon RDS vs. SQL Azure
- Azure Gets its First Commercial ERP App
- Qt DevDays 2009 - Munich
- Installing Geneva Beta 2 on Windows 7
- Binary Serialization and Azure Web Applications
- Yahoo! to Present at 4th International Cloud Computing Expo
- Microsoft’s First Step Toward Cloud Computing
- Social Media on Ulitzer - Strategy Nets New AUM for RIA
- EC Wrong, Wrong, Wrong – and Sloppy to Boot: Intel
- Adobe Flex Developer Earns $100K in New York City
- This Bing Thing Is Working
- Jill T. Singer of CIA to Present at Cloud Computing Expo on November 2
- Visual Studio 2010 Is Cloud Friendly
- SplendidCRM for Microsoft Windows Azure
- Azure on Ulitzer - Microsoft’s Cloud Builder Floats to Cisco: Report
- Governmental Cloud Interoperability on The Microsoft Cloud
- Microsoft Falls Off Cliff, Keeps on Ticking
- Where Are RIA Technologies Headed in 2008?
- The Top 250 Players in the Cloud Computing Ecosystem
- Accessing the ASP.NET Authentication, Profile and Role Service in Silverlight
- Silverlight 2 - Adobe Flex Killer Is on Its Way!
- Building Great AJAX Applications Using ASP.NET
- Spice Up User Experience with Silverlight
- Is the Silverlight Adoption Rate Artificially Inflated?
- Kaazing Announces Support for Silverlight
- Will Google's Android Sink or Swim?
- VS 2008 Builds AJAX-based Web Apps
- Rich Content Rotator for ASP.NET
- Getting Started with Silverlight: Zero to Hero

































