Wednesday, June 24, 2009

What is the Adorner Layer?

I attended some WPF training in Chicago and talked with one of the presenters, Karl Shifflett. He give the most simple explanation of what the adorner layer is.

It is a layer on top of controls that allows you to decorate them without affecting their layout.

A simple example might be placing a red border around a textbox to highlight an error. If this is done at the adorner layer you will see the red highlight but it will not affect the position of the controls underneath.

WPF Converter not firing on NULL

Yesterday I spent some time tracking down a problem with a converter. I was trying to show an icon when the ReviewReasonId, int property of an object had a non-zero value. I was passing ReviewReason.ReviewReasonId into the converter. The problem was when ReviewReasonId was null the converter was not getting called at all.

< Image Grid.Column="0" Source="Resources/ExclamationSign.ico"
Visibility="{Binding Path=ReviewReason.ReviewReasonId, Mode=OneWay,
UpdateSourceTrigger=PropertyChanged,
Converter={StaticResource ReviewReasonVisibilityFormatter}}"/>


Finally I realized that if ReviewReason is null, as opposed to ReviewReasonId, the converter is not called. I simply removed .ReviewReasonId, bound to ReviewReason instead, cast the object as a ReviewReason and checked for the ReviewReasonId property and all is well.

Thursday, June 18, 2009

WPF MVVM Training

I just attended Microsoft's WPF MVVM training in Chicago. Got up at 5:30AM in Columbus, OH, arrived at the training right on time at 9am and didn't even get lost without a GPS.

I am pretty familiar with WPF so I skipped the first day, which was a lap around WPF and attended the MVVM session. What a brain cramming day! I couldn't even send a text without getting left behind, that's how fast it moved but it built precept upon precept so if you listened it all hung together.

Shifflett and Rodriguez were masters of their trades and came with a great depth of information. Shifflett was very entertaining as a speaker and of course for him all things hard are a "No brainer!"

Now it's time to sit down and develop a strategy to apply what was taught.



Karl was kind enough to stay behind and talk with us after the session and take photos.