Silverlight Behaviors and Triggers: Making a Trigger Action

So far we’ve explored how to use dependency properties and attached properties to create reusable behaviors and triggers. I showed you recently how to refactor an attached property to use the Behavior base class instead. Today, we’ll look at the TriggerAction that is also available in System.Windows.Interactivity (either as a part of Expression Blend, or…

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,…

Initially Turning on FxCop/Code Analysis for a Large Code Base

Recently I was asked a question that’s come up several times so I thought I’d share the answer. I’ve inherited a large code base that has never had FxCop run on it. When I ran the binaries through FxCop, it reported tens of thousands of warnings, which overwhelmed me. While I should fix those warnings,…

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…

Updated Compile-Help.PS1 and Neat PowerShell Scripting Tricks

One of my favorite PowerShell scripts of all time is Jeff Hillman’s Compile-Help. Instead of attempting to read the PowerShell help in a text window, Jeff’s outstanding script packages up all the help into a searchable, linkified, and easy to read Compiled HTML Help (.CHM) file. Especially if you are new to PowerShell, easily being…

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…

Changing the Visual Studio Splash Screen Registered User

On a mailing list I subscribe to, there was an interesting question, “How do you change the user information shown in the Visual Studio splash screen?” I’ve circled in red the user information below. As I was curious about the same thing because my copy of Visual Studio shows that my company name is Microsoft,…

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…