Skip to main content
  • 508 Accesses

Abstract

So far in this book, you’ve learned how to bind your user interface controls to objects so that the user can view and edit data exposed by these objects. Instead of data being pushed into these controls, the extensive data binding support provided by XAML enables controls to pull the data into themselves. In other words, the controls are essentially controlling the process of consuming the data. You’ve learned that

  • The object assigned to the DataContext property of a control is inherited down the object hierarchy.

  • There are three different binding modes: OneTime, OneWay, and TwoWay (discussed in Chapter 2). You need to set the mode to TwoWay to update the bound object property via a control in the user interface.

  • You can notify the bindings when bound property values on an object have changed, using the INotifyPropertyChanged interface, discussed in Chapter 7.

  • You can notify the bindings when bound property values (or the bound object itself) are invalid by throwing exceptions, implementing the IDataErrorInfo interface, or by implementing the INotifyDataErrorInfo interface, as discussed in Chapter 7.

  • The ObservableCollection<T> type can be used to maintain items in your collections, which will notify the bound user interface controls when items have been added or removed from the collection so they can update themselves accordingly (discussed in Chapter 6). Alternatively, you can implement the INotifyCollectionChanged interface in your own collection classes to enable them to exhibit the same behavior.

  • You can create a view of a collection by wrapping it in a collection view, enabling the data in the collection to be manipulated (e.g., filtered, sorted, grouped, and paged) without actually modifying the underlying collection (discussed in Chapter 6). Collection views also provide a current record pointer that tracks the current item in the collection, enabling multiple controls bound to the same collection view to be kept synchronized. They also provide the ability to move this pointer and navigate through the items in the collection.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Chris Anderson

About this chapter

Cite this chapter

Anderson, C. (2012). Advanced Data Binding. In: Pro Business Applications with Silverlight 5. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-3501-9_11

Download citation

Publish with us

Policies and ethics