Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
395 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
| Software ==> | WPF - Visual C# (20 exercises) |
| Topic ==> | Basic binding (2 exercises) |
| Level ==> | Average difficulty |
| Subject ==> | WPF training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
Open the window in the above folder, and make it the default window for your application. When you run the application, you should see a combo box:

A basic combo box bound to the SuitName property of the underlying class. Take a peek at the code-behind to see that the underlying class exposes two public properties: SuitName and ImageName.
Change your combobox into a listbox (this should take seconds - they work the same way), then add a data template section to the listbox:

The start of the data template.
Within this data template for how the listbox appears, add:
Here's a suggestion for how your listbox could look:

You should be able to select any suit.
Now attach an event to the MouseDoubleClick event of the ListBox, and in this event:
Here is suggested code to do this!
private void lstSuit_MouseDoubleClick(object sender,
MouseButtonEventArgs e)
{
// get at the listbox just double-clicked on
ListBox lb = (ListBox)sender;
// show its suit
clsSuit suit = (clsSuit)lb.SelectedItem;
MessageBox.Show(suit.SuitName);
}
When you double-click on a suit, you should see a message as shown on the next page.
Here's the sort of message which you should get when you double-click on a suit:
|
|
| Double-click on a suit ... | ... to see its name! |
Reflecting on just how powerful WPF is (and just how time-consuming it can be) close down any windows you have open.
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2026. All Rights Reserved.