Category selection code behind
Inheritance: Microsoft.Phone.Applications.UnitConverter.View.PageCommon
 /// <summary>
 /// Adds the pivot items for the unit categories.
 /// Create a new pivot item for each category, and a user control that will have
 /// the required two list boxes for each pivot item.
 /// </summary>
 /// <param name="view">The view.</param>
 private static void AddPivotItems(CategorySelection view)
 {
     foreach (CategoryInformation category in ApplicationState.SupportedConversions)
     {
         PivotItem p = new PivotItem();
         TwoListBoxes l = new TwoListBoxes();
         l.Name = "pivotItem" + category.CategoryLocalized;
         l.FromSelectionChanged += new SelectionChangedEventHandler(view.OnFromSelectionChanged);
         l.ToSelectionChanged += new SelectionChangedEventHandler(view.OnToSelectionChanged);
         p.Header = category.CategoryLocalized;
         p.Content = l;
         view.pivot.Items.Add(p);
         // Store the TwoListBoxes object in the category for later access
         category.PivotUnitSelect = l;
         category.PivotUnitSelect.toListView.ItemsSource = null;
         category.PivotUnitSelect.fromListView.ItemsSource = null;
     }
 }
 /// <summary>
 /// Setup the required data object to be able to data bind to the list views in the 
 /// pivot control
 /// </summary>
 /// <param name="view">View </param>
 internal static void InitializeCategoryBinding(CategorySelection view)
 {
     AddPivotItems(view);
 }