title: silverlight 3 collection binding
body: <p>Someone please help me understand why this binding does not work...</p>
  
  <p>I have a class called SelectionManager with a property called 'dates' which is populated by a WCF service.  The property is an array of structs which bundles a DateTime and an integer count of business objects.  </p>
  
  <pre><code>public class SelectionManager : INotifyPropertyChanged {
  
      ... other properties ...
  
      public DQMServiceDateCountPair[] dates { get; private set; }
  
      public event PropertyChangedEventHandler PropertyChanged;
  
      public void NotifyPropertyChanged(string propertyName) {
          if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); }
      }
  </code></pre>
  
  <p>I have another class called DateSelector which has a DependencyProperty called 'pairs' setup to be the binding target of 'dates'.</p>
  
  <pre><code>public partial class DateSelector : UserControl {
  
  ... other stuff ...
  
  public static readonly DependencyProperty pairsProperty = DependencyProperty.Register(
      "pairs",
      typeof(DQMServiceDateCountPair[]),
      typeof(DateSelector),
      new PropertyMetadata(new DQMServiceDateCountPair[0])
  );
  
  public DQMServiceDateCountPair[] pairs {
      get { return (DQMServiceDateCountPair[])GetValue(pairsProperty); }
      set { 
          Debug.WriteLine("adding dates");
          SetValue(pairsProperty, value);
          dateMode = DateMode.Years;
      }
  }
  
  }
  </code></pre>
  
  <p>In my MainPage.xaml, I have a line like this:</p>
  
  <pre><code>&lt;date:DateSelector x:Name="dateSelector" pairs="{Binding dates}" /&gt;
  </code></pre>
  
  <p>It's weird, because all my other bindings in MainPage.xaml update correctly, including a ComboBox bound to 'dates'.  My UserControl however, will not update.  The Debug.Writeline doesn't get called in the set statement of the 'pairs' property.  </p>
  
  <p>In playing around with it, I've tried making the DQMServiceDateCountPair[] property into an ObservableCollection and implementing INotifyCollectionChanged, but that doesn't help.  </p>
  
  <p>If I leave either the source property or the target property as an array, and make the other an ObservableCollection, then I get a binding error that says it can't automatically convert one to the other, so Silverlight seems aware of the binding, it just doesn't update it.</p>
  
  <p>Can anyone help?</p>
  
  <p>P.S. I'm using Silverlight 3.</p>