Normally when I need to present a complex lookup I would spawn a new form have the user select a row from a carefully crafted UI and return the single value result back to a combo style element on my main form. When less complicated lookup’s are required a drop down list with concatenated fields may have sufficed, but not anymore…
In the midst of a recent sprint I found myself needing a little more. The task at hand was to provide an easy way to select a job from a collection (currently around 2000 entries and growing), the problem was not everyone would want to use a single field, they may not know the job name. Some users would be more comfortable with the claim number, or the client name. Enter the XtraEditors.SearchLookupEdit control.
I almost tripped over this control whilst trolling through the extensive collection of items in my toolbox. The name intrigued me so I decided to investigate a little further and was surprised at the power this little guy punched.
In a nutshell it is a container with a grid, text field and button, but don’t be fooled, I found it to be fast, quick to configure and simple to implement. For me the steps were;
1. Add SearchLookUpEdit control to form
2. Bind to existing datasource (and specify field as return value)
3. Adjust column properties (keeping UI noise to a minimum)
4. Tweak a few specific appearance properties (finding the drop down width was a pain)
5. Hookup an event
6. Test
Because you can control all aspects of appearance you can pretty much make the style fit any WinForm design.
The power comes from the ‘out-of-the-box’ features on the control, users can filter, search, group, select columns etc and all without chewing up valuable screen real-estate. I know that from now on I’ll be looking to use the SearchLookUpEdit control in more places, and it taught me not to undervalue some of the ‘smaller’ common controls at my disposal.
(Picture taken from DevExpress website, my use of the control contain confidential data).