Developing Testable Silverlight Applications: Part One – Abstracting Data Persistence

At Microsoft PDC 2009 I gave a talk entitled “Developing Testable Silverlight Applications”. We looked at how to use the Inversion of Control principle with the Model-View-ViewModel design pattern to isolate the dependencies within a Silverlight 4 application for easier testing. We also saw how to improve testability by taking advantage of the natural boundaries…

6

Making multiple selection in a DataGrid bindable

A customer recently asked how to change the selection of a row in the Silverlight 3 DataGrid based on the values of the columns. The brief answer is to add an event handler for LoadingRow and call dataGrid.SelectedItems.Add(e.Row.DataContext), but the customer did mention that he was using M-V-VM and that got me thinking. The selection state of…

6

Failures in .NET RIA Services are silent by default

Due to the async nature of the .NET RIA Services programming model, exceptions and errors during load and submits aren’t thrown on the client. Instead, the errors are exposed through an Error property which can be found in the event args instances passed in to handlers for the Loaded and Submitted events. So, the first thing I…

1

Building a dual thumb slider for Silverlight 2 Beta 1

  hosted by Silverlight Streaming – the source is available as an attachment at the bottom of this post. The Slider control that shipped with the Silverlight 2 Beta 1 SDK only supports picking a single value. Back at Mix08 in March I threw together a control that allows selecting a range using two thumbs, but…

1

Re-templating a WatermarkedTextBox

Hosted by Silverlight Streaming   Ta-da! Here’s a new look for the WatermarkedTextBox (a.k.a. WTB) in Silverlight 2 Beta 1. This was relatively simple to do just by changing the template. Here is the XAML for the template:     <ControlTemplate x:Key=”wtbTemplate”  TargetType=”WatermarkedTextBox”>         <Grid x:Name=”RootElement” >             <Grid.Resources>                 <Storyboard x:Key=”Disabled State”>                     <DoubleAnimation Storyboard.TargetName=”DisabledVisual”                                    …

1

How to set the XAML editor to full view by default

For hard-core XAML programmers or just to boost performance when working with XAML files in VS 2008, you may want to have the default view be just the XAML editor (no designer visible). To do so, select the Tools->Options… menu item. Then navigate in the tree view to Text Editor->XAML->Miscellaneous. Check the box for “Always open…

0

Silverlight 2 Beta 1 Hints

Remember, it is a beta so there are going to be some things that are by design and others which just need temporary workarounds. Here are some things I learned when developing and testing some of the controls delivered as part of the Silverlight 2 Beta 1 SDK. 1.      Unlike WPF, the xaml in Silverlight 2…

2