in

WPF Design and Development

IdentityMine Team Blogs

Sajiv Thomas

WPF DataBinding, 3D, Graphics, Controls, Silverlight

Implementing Master-Detail made easy in WPF.

We often need to implement master-detail scenarios in our applications.

ListBox (also ComboBox) has a property called IsSynchronizedWithCurrentItem which makes it very easy to implement master-detail scenarios.

You can set the IsSynchronizedWithCurrentItem property to true to ensure that the item selected always corresponds to the CurrentItem property in the ItemCollection(source of data for the ListBox).

For example, if we need to have Listbox(MasterList) showing images of products and a details pane showing details of the image selected in the ListBox.

All we need to do is set the DataContext for the ListBox and details pane to the same ItemsCollection and set the IsSynchronizedWithCurrentItem on the ListBox to true.

You can find the source code attached.

#Note: This sample uses no C# code, only XAML.

Here is an interesting link on Selection Synchronization

 

Published Mar 26 2007, 02:57 AM by Sajiv
Filed under:

Comments

No Comments
© 2007 IdentityMine, Inc.
Powered by Community Server (Commercial Edition), by Telligent Systems