jmccurdy

Stories kicked by jmccurdy

Generic class for deep clone of Silverlight and CLR objects(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 2 months ago

I created a class that would clone with both generic CLR objects, as well as Sliverlight objects deriving from FrameElement, and objects that included DependencyObject's and DependencyProperty's. I wanted a solution that would work for all types, not just objects that were flagged as serializable. So here is the "CloneObject" class. read more...

add a comment |category: |Views: 66

tags: another

ColorFromString for Silverlight or .NET(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

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 •ARGB colors as Hex (8 nibbles) •RGB colors as Hex (6 nibbles) •ARGB colors as comma or space separated decimal •RGB colors as comma or space separated decimal read more...

add a comment |category: |Views: 4

tags: another

Cookies for Silverlight(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

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 in “n” days read more...

add a comment |category: |Views: 16

tags: another

The simplest way to detect DoubleClick in Silverlight(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

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. read more...

add a comment |category: |Views: 19

tags: another

Settings for Silverlight using IsolatedStorageSettings(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

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 remember; since a user has the freedom to purge isolated storage at will, this class is mostly useful for storing application preferences like layout sizes and locations, and other creature comforts for regular users. This class can read or write any data type to settings storage; the IsolatedStorageSettings class will automatically serialize and deserialize the settings for you. read more...

add a comment |category: |Views: 20

tags: another

A TextBox that selects its text on focus for Silverlight(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

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. So to satisfy user expectations as a matter of consistency, I wrote a very simple derived class, TextBoxEx, that will offer this functionality. The TextBoxEx class derives from TextBox, and can be referenced in XAML for any and all of your TextBox’s. There are no methods to call. It just listens for Focus events and selects it own text. Very simple. read more...

add a comment |category: |Views: 14

tags: another

Easy access to Silverlight file resources with my ResourceFile class(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

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. read more...

add a comment |category: |Views: 11

tags: another

Implement MouseWheel support for Silverlight 3 controls(yinyangme.com)

submitted by jmccurdyjmccurdy(40) 2 years, 3 months ago

In the upcoming Silverlight 4 release, mousewheel support for controls will be implemented out of the box. However Silverlight 3 still requires you to roll your own mouse wheel support. The following MouseWheelProps class provides generic mousewheel support for all Silverlight controls that support the IScrollProvider interface (ScrollViewer, ListBox, DataGrid) or the IRangeValueProvider interface (Slider). This class implements a single attached property called Enable that can be added directly to a control, or as a style for a control. read more...

add a comment |category: |Views: 8

tags: another