110 likes | 205 Views
INDIA │ 18-20 august 2010. virtual techdays. Data Driven – Master/Details Business Forms with WPF 4 & EF4. Amar Nityananda │ Partner Technical Consultant, Microsoft. INDIA │ 18-20 august 2010. virtual techdays. Master-Details forms – a common scenario
E N D
INDIA │ 18-20 august2010 virtual techdays Data Driven – Master/Details Business Forms with WPF 4 & EF4 AmarNityananda│ Partner Technical Consultant, Microsoft
INDIA │ 18-20 august2010 virtual techdays • Master-Details forms – a common scenario • Demo: Creating master-details forms with WPF 4 and EF 4 • Understanding what happens behind the scenes • CollectionView & CollectionViewSource • BindingListCollectionView • Selector.IsSynchronizedWithCurrentItem S E S S I O N A G E N D A
INDIA │ 18-20 august2010 virtual techdays • Shows a set of ‘master’ records and the user can drill down into further ‘details’ • Ideal for visualizing one-to-many relationships • Ex: Categories Related products • Useful for displaying detailed information from tables having a lot of columns Master-Details forms – a common scenario
INDIA │ 18-20 august2010 virtual techdays DEMO: Creating Master-Detail form with WPF4 and EF4 AmarNityananda│ Partner Technical Consultant, Microsoft
INDIA │ 18-20 august2010 virtual techdays • Think of a CollectionView as a layer on top of a binding source collection. • A view does not change the underlying source collection, so a source collection can have multiple views associated with it i.e., you can display the same data in different ways. • All collections have an associated default collection view. We can get the default view using the CollectionViewSource.GetDefaultView method. Understanding what happens behind the scenes CollectionView
INDIA │ 18-20 august2010 virtual techdays • CollectionViewSource is a proxy for a CollectionView class. • It has a View property that holds the actual view and a Source property that holds the source collection. Understanding what happens behind the scenes CollectionViewSource
INDIA │ 18-20 august2010 virtual techdays • For collections that implement IBindingListView or IBindingList, the default collection view is BindingListCollectionView. • IBindingList is required for BindingListCollectionView • IBindingListView is an optional interface that gives additional functionalities. • Derives from CollectionView • Implements IComparer, IEditableCollectionView, IItemProperties • Useful methods: • AddNew • RemoveAt • CommitNew Understanding what happens behind the scenes BindingListCollectionView
INDIA │ 18-20 august2010 virtual techdays • Set the IsSynchronizedWithCurrentItem property to true to ensure that the item selected always corresponds to the CurrentItem property in the ItemCollection. • true if the SelectedItem is always synchronized with the current item in the ItemCollection • false if the SelectedItem is never synchronized with the current item; • null (Nothing in Visual Basic) if the SelectedItem is synchronized with the current item only if the Selector uses a CollectionView. The default value is null (Nothing in Visual Basic) Understanding what happens behind the scenes Selector.IsSynchronizedWithCurrentItem
INDIA │ 18-20 august2010 virtual techdays • CollectionView • http://msdn.microsoft.com/en-us/library/system.windows.data.collectionview.aspx • Details on the CollectionView class • BindingListCollectionView • http://msdn.microsoft.com/en-us/library/system.windows.data.bindinglistcollectionview.aspx • Details on the BindingListCollectionViewclass • Blogs • http://bea.stollnitz.com/blog/?p=13 – Bea on Master-detail • http://blogs.msdn.com/b/bethmassi/archive/2009/07/14/master-detail-data-binding-in-wpf-with-entity-framework.aspx - Beth on Master-Detail Data Binding in WPF with EF RESOURCES
INDIA │ 18-20 august2010 virtual techdays • WPF4 deep-dive • Gowtham Prasad K N • 4:15-5:15, 18th August (Recording will be available on the VTD site) RELATED CONTENT
THANKS│18-20 august2010 virtual techdays Amar.Nityananda@microsoft.com