Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

3. Advanced Data Binding > Combining converters, data binding, and DataContext ...

Combining converters, data binding, and DataContext into a custom DataTemplate

Applies to Silverlight 3, 4 and 5

A lot of things we've talked about in this chapter are great features on their own, but they really shine when you combine them and let them work together. This recipe will show you how to bring some of the most powerful and built-in features of the Silverlight SDK together or, to put it differently, how to program "The Silverlight Way". We're going to create an editable ComboBox of people using a custom DataTemplate, the DataContext, an ObservableCollection with two-way data binding, and Converters to make the UI fluid, interactive, and responsive.

Getting ready

We're starting off with a completely new, blank Silverlight solution for this recipe. So, to get started, make sure you have one of those. To create an empty Silverlight solution, start a new Silverlight project in Visual Studio by selecting File | New | Project... and let it create an accompanying web application automatically for hosting the Silverlight application. Name the project Editable_Combobox.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint