For a more in-depth example, please see the latest video and download the source code.This entry was posted on Tuesday, March 24th, 2009 at pm and is filed under Update Controls. We can basically scratch everything we have in our Main except for the underlying grid.Within the grid we just want to add a simple List View.Back in our code behind, we can keep our Main Page_Loaded event handler and scratch everything else.We just need to declare an instance of Movies Data Source, initialize it in the loaded event handler, and then set the Items Source property of our List View to that instance. public sealed partial class Main Page : Page Here comes the moment of truth. Run it in the Windows phone emulator and you should see the same thing. Granted this doesn’t look over pleasingly to the eye, but keep in mind I am no UI expert and this isn’t a tutorial on pleasant looking apps :) I mentioned it earlier but the next and final post in this series will cover using dynamic data. While the original source collection is observable, the query is not.Filtered collections are not observable In the following example, one list box is bound to People, while another is bound to People Starting With P. One commonly used solution to this problem is to programmatically set either the Data Context or Items Source to force the list to be updated. The markup should declare its own Items Source, and not rely on code to set it.
If we instead used a simple List, we would have to do the notification part manually.We will get the data from the Rotten Tomatoes API so stayed tuned for Part 5.Feel free to follow me on twitter for upcoming posts!This works, but it completely defeats the purpose of using Observable Collection Writing code that reaches back into the XAML and sets properties is backwards. Query parameters are not observable Another problem with this approach occurs when the filter in the Linq query references other data. First Letter is independent -- the user can change it.
For example, if we want the user to choose their own first letter, the list should update when a new letter is chosen. First Letter fires an event indicating that People Starting With First Letter has changed. People Starting With First Letter is dependent -- it only responds to change.There are two key phrases here that jump out to me, “dynamic data collection”, and “provides notifications when items get added…”.