title: ComboBox to show only unique values of a field in an ICollectionView
body: <p>I have a DataGrid with its ItemSource bound to an <code>ICollectionView</code> (for filtering). I'm trying to have a ComboBox which will filter the <strong>EffectiveDate</strong> column in the DataGid, its ItemsSource (dropdown values) should be the <strong>EffectiveDate</strong> of all currently available rows (there are other filters too) in the DataGrid.</p>
  
  <p>Here's the code:</p>
  
  <p>In the <strong>MainWindow:</strong></p>
  
  <pre><code>&lt;DataGrid Name="ProductsList"
            ItemsSource="{Binding PricesView}" AutoGenerateColumns="False"&gt;
      &lt;DataGrid.Columns&gt;
              &lt;DataGridTextColumn Binding="{Binding Sku}" Header="Sku"/&gt;
              &lt;DataGridTextColumn Binding="{Binding Upc}" Header="UPC"/&gt;
              &lt;DataGridTextColumn Binding="{Binding Cost}" Header="Cost"/&gt;
              &lt;DataGridTextColumn Binding="{Binding Map}" Header="MAP"/&gt;
              &lt;DataGridTextColumn Binding="{Binding List.EffectiveDate, StringFormat=d}" Header="List Effective Date"/&gt;
              &lt;DataGridTextColumn Binding="{Binding List.Vendor.Name}" Header="Vendor"/&gt;
      &lt;/DataGrid.Columns&gt;
  &lt;/DataGrid&gt;
  
  &lt;ComboBox ItemsSource="{Binding PricesView}" DisplayMemberPath="List.EffectiveDate"/&gt;
  </code></pre>
  
  <p>In the <strong>MainWIndowViewModel:</strong></p>
  
  <pre><code>public ICollectionView PricesView { get; set; }
  
  public ObservableCollection&lt;Price&gt; Prices { get; set; } = new ObservableCollection&lt;Price&gt;(DataAccess.GetVendorPricing());
  
  public MainWIndowViewModel()
  {
      PricesView = CollectionViewSource.GetDefaultView(Prices);
  }
  </code></pre>
  
  <p><strong>Price Class:</strong></p>
  
  <pre><code>public class Price
      {
          public int Id { get; set; }
          public PriceList List { get; set; }
          public string Sku { get; set; }
          public string Description { get; set; }
          public string Upc { get; set; }
          public double Cost { get; set; }
          public double Map { get; set; }
      }
  </code></pre>
  
  <p><strong><code>List</code> above is of type <code>PriceList</code>:</strong> (Here's where you find the <code>EffectiveDate</code> property)</p>
  
  <pre><code>  public class PriceList
      {
          public int Id { get; set; }
          public Vendor Vendor { get; set; }
          public string FileName { get; set; }
          public DateTime EffectiveDate { get; set; }
      }
  </code></pre>
  
  <p>The issue is that the ComboBox brings up the <strong>EffecitveDate</strong> for each row (thousands of them!), what I need is just the unique values.</p>
  
  <p>I tried <a href="https://stackoverflow.com/questions/5995989/distinct-values-in-wpf-combobox">this</a> method, using an <code>IValueConverter</code>, the problem is that converter takes in the entire <code>ICollectionView</code> without the  <code>DisplayMemberPath</code> and returns distinct values of the entire collection (which is basically everything), what I'm after is distinct values of only this specific field.</p>
  
  <p>How can I have the ComboBox only show unique values of <strong>EffectiveDate</strong>?</p>