Silverlight Behaviors and Triggers: TextBox Magic

The TextBox control is popular in Silverlight but comes with a few nuances. For example, the default behavior is that the data is not bound until the control loses focus! This can be awkward when you have a form with a disabled save button. The save button won’t enable until the text box contains content,…

Silverlight Behaviors and Triggers: Storyboard Trigger Example

One of the most powerful benefits of Silverlight is that it uses the DependencyProperty model. Using this model, you can create attached properties to describe reusable behaviors and attach those behaviors to certain elements. An example of this is firing animations in the UI elements. One criticism of Silverlight has been the lack of support…

Dynamic Silverlight Controls

I’ve had some fun with dynamic controls lately. Wanted to share a few caveats that I found for those of you trying to spin some of your own. The premise is simple: we have XML configuration that drives the UI, so based on the values parsed from the XML, we generate the appropriate control. I…

Silverlight/Prism ViewModel and DelegateCommand

In yesterday’s post about Decoupled ChildWindow Dialogs in Silverlight using Prism, I demonstrated a way to use EventAggregator to decouple the implementation of a dialog from the code that requires the confirmation. In one example, I showed a code-behind click event that fired off the process, something like this: private void Button_Delete_Click(object sender, System.Windows.RoutedEventArgs e)…

Silverlight ComboBoxes and the Importance of Equals

So I was struggling for awhile with a binding issue in my Silverlight application, and learned the hard way that I forgot my basics. The scenario is fairly common. I have a view model that contains the entity I want to edit along with supporting lists. The common example I see on the web is…

Decoupled ChildWindow Dialogs with Prism in Silverlight 3

A common user interface component is the confirmation or message box, which is often presented as a dialog returns a boolean (OK/Cancel). There are a variety of ways to achieve this, but how can you decouple the implementation of the popup from the request itself? This is necessary, for example, for unit testing when you…

A Twist on the Twist of the Observer Pattern

Thanks to those of you who read my Twist on the Observer pattern and gave me the feedback. You said, “Hey, Jeremy, that’s neat, but there is already a pattern established for what you’re talking about, and a few great solutions ready to use. Besides, they are much, much more powerful…” Thanks to Microsoft MVP…

Silverlight on IE6: Nagging Security Bug

Do you have a wonderful Silverlight application that you enjoy running in all of the glorious browser flavors available, only to find out that some weird quirky issue pops up in our old friend, Internet Explorer version 6.0 (IE6)? Perhaps you were as puzzled as we were when IE6 would complain with a “Security warning:…

IUnityContainer and the Rabbit Hole

I’m working on an exciting project using Silverlight and the PRISM framework/Composite Application Library. It is perfect for our use as a rich, interactive line of business application that has a lot of features. We want to be able to quickly and easily extend areas of functionality (which the dependency injection and region management features…

A Twist on the Observer Pattern

The observer pattern is well established and used. The typical scenario is to register to an class and then allow your Notify method to be called. This often involves keeping an internal list of observers and then iterating them to notify that something has changed. I had a situation recently that warranted a lighter weight…

More Confusion over “by ref” versus “Reference Types”

Apparently my prior blog post about “by ref” versus “reference type” caused quite a stir and a bit of confusion. I think the underlying issue is that people confuse “by ref” as having something to do with “reference types.” They are not the same. Reference types and value types are about instances, passing by ref…

What’s in Your Collection? Part 3 of 3: Custom Collections

This is the last installment in a three part series about using collections in C#. The entire series can be accessed here: Part 1: Interfaces Part 2: Concrete Part 3: Custom Collections We’ve now covered the interfaces and some concrete instances of collections provided by the .NET Framework. Now you are interested in moving things…