Jim McCurdy's Tech Blog

Insights into C#/XAML Development; Windows 8 (WinRT), WPF, Windows Phone, Xamarin, Silverlight

Generic class for deep clone of Silverlight and CLR objects

Update: As of 8/11/2010, I have released the following update of the source code for my CloneObject class.  This update adds the ability to clone any attached properties found in the loaded assemblies, and also removes an unnecessary dependency property loop which will speed up some operations… Update: As of 7/19/2010, I have updated the source code for my CloneObject class.  The ... [More]

Implement MouseWheel support for Silverlight 3 controls (and for Silverlight 4 Slider and TreeView)

In the upcoming Silverlight 4 release, mousewheel support for controls will be implemented out of the box for the ScrollViewer, DataGrid, and ListBox controls.  However Silverlight 3 still requires you to roll your own mouse wheel support.  And Silverlight 4 does not offer a scrolling solution for Slider and TreeView. The following MouseWheelProps class provides generic mousewheel suppor... [More]

Easy access to Silverlight file resources with my ResourceFile class

Silverlight application developers have several choices when deploying file resources for a Silverlight application.  For my own Silverlight application, YinYangMoney, I developed a ResourceFile class to make access to those resource files flexible and simple - regardless of the deployment choice.  I will be sharing that class with you in this blog post. Background on Silverlight File Re... [More]

A TextBox that selects its text on focus for Silverlight

A minor annoyance of mine is that there is no way to wire up a standard Silverlight TextBox to select its text when it receives the keyboard focus; either via a mouse click or a tab key. And since users are accustomed to web apps, browsers, and desktop applications that offer the the convenience of selecting textbox text  upon focus, I wanted that behavior in my Silverlight applications.&nbs... [More]

Settings for Silverlight using IsolatedStorageSettings

Here is a simple static class, Settings, that offers methods to Read and Write application settings and preferences from Silverlight applications.  These settings are similar to the ones that Windows apps would store in the registry or in an INI file, but in this case, are written to Silverlight’s isolated storage. This class wraps Silverlight’s IsolatedStorageSettings class, so r... [More]

The simplest way to detect DoubleClick in Silverlight

Here is a simple static class, MouseButtonHelper, that offers a single method, IsDoubleClick,  to determine if a standard MouseLeftButtonDown or MouseLeftButtonUp event is a double click.  In the past I have used timers, and Triggers and Behaviors to accomplish the same thing, but this approach is less code, less XAML, and uses a lot less resources. Usage is as follows: In XAML or in co... [More]

Cookies for Silverlight

Here is a simple static class, Cookie, that offers methods to Read and Write cookies from Silverlight applications.  You can also specify the cookie expiration as a number of days: expireDays = 0, indicates a session cookie that will not be written to disk expireDays = -1, indicates that the cookie will not expire and will be permanent expireDays = n, indicates that the cookie will expire ... [More]

ColorFromString for Silverlight or .NET

Here is a simple static class, ColorFromString, that offers a single string extension method, ToColor, to create Color objects from various strings representations of color: Named colors “Red” “Yellow” “Chartreuse” ARGB colors as Hex (8 nibbles) “#FF00FF00” for opaque green “#80FF00FF” for translucent magenta RGB c... [More]

In the beginning…

I resisted starting a new tech blog, because I thought that writing about what I do would only distract me from the current project at hand.  But hopefully this blog will give me the outlet I need to promote my work, and allow me to give a little back to the development community that has enriched my own work. So on this blog I will likely focus on software development techniques in general,... [More]