Archive for July, 2009

Auto-Select First Item Using XAML for Selector-Derived Controls (ListBox, ListView, TabControl, etc)


When your application has a control on it that derives from Selector and has no items on load nothing is selected. During run-time when the user is clicking around and adds items to the Selector-derived control, you would assume that the control would automatically select the first item because that only makes sense. However, your assumption and mine would be wrong; this is not the behavior at all. Instead the selector will still have no items selected. This means in order to get this “auto-select first item” behavior, you have to do it yourself. Luckily its an easy fix as shown below.

Read the rest of this entry »

, , , , , ,


WpfMessageBar – Version Released on CodePlex

I’ve always disliked dialog boxes… especially ones that only have an “OK” button on it. These sorts of dialog boxes are not very helpful because they stop the user in there tracks to tell them something and then force them to click “OK”. I really don’t like that scenario so I came up with an alternative method of accomplishing the same thing in what I think is a better way.

Its called a message bar and by default it sits on the bottom of a window where the status bar would normally be. When the program needs to subtly tell the user something and the user doesn’t have to make an immediate decision, you can use the message bar. It is not meant for letting the user take an action… so no “Do you want to save?” scenarios. I like this approach better because it still draws attention, but doesn’t stop the user from what there trying to do. Use it when saving to a file failed, when there network connection drops, when they entered an invalid value, etc.

All the details, source code, samples, and screenshots can be found at:

, , ,

Leave a comment