Regex hints #1

I love the power of regular expressions to do highly repetitive work for me, but I don’t use them frequently enough to remember the exacting intricacies of the syntax. Time for a series of posts with examples that have worked for me. First up, is the conversion of standard properties to notification properties. This can... Continue Reading →

Silverlight Commands – Data grid row selected

following on from and in response to John Papa’s PDC talk Another highly useful command behaviour is for DataGridRowSelected. This also gets over the issues described here and here. The code (as written by John Papa) is: public class DataGridRowSelectedCommandBehavior : CommandBehaviorBase{public DataGridRowSelectedCommandBehavior(DataGrid selectableObject): base(selectableObject){selectableObject.SelectionChanged += OnSelectionChanged;}private void OnSelectionChanged(object sender, SelectionChangedEventArgs e){this.CommandParameter =... Continue Reading →

Data-binding Radio Buttons in Silverlight to Enum

In Silverlight there is no Enum.Getvalue() method, so there is not out-of-the box way of databinding a radio buttongroup to an enumerable value in a viewmodel. Step forward converters. using System;using System.Windows.Data;namespace YourNamespace{ public class EnumBoolConverter : IValueConverter{ #region Methods public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture){ if (value == null ||... Continue Reading →

Date issues in Silverlight

Seeing some strange date behaviours in SL UI components. My local culture is UK but we keep seeing US dates popping up “here and there”. Have tried setting the Language= “en-GB” in the upper most control, also setting the thread culture is not effecting across the app. Going to have to get help on this... Continue Reading →

Cross Project MergedDictionaries in Silverlight

Todd Miranda has posted a video on the use of merged dictionaries on the Learning portal of (find it here). This video explains the concepts of MergedDictionaries in a very long winded way. IMHO people investigating MergedDictionaries will already know how to layout a grid, and play some simple controls, so the first 8m... Continue Reading →

.NET Debugging and Stack Trace

When debugging enable the stack trace view to see where code has been triggered from. This is particularly useful for figuring out where events have been triggered from (delegation of event handlers from multiple places etc):

A Website.

Up ↑