title: filtering with combobox wpf ef
body: <p>I am trying to search the table Station using multiple comboboxes, that are binded to the station collection and every combobox contains differrent "column name" from station, like: station.street, station.city etc. Here are my code samples:
  XAML:</p>
  
  <pre><code>&lt;ComboBox Margin="0, 5" 
      ItemsSource="{Binding StationCollection, UpdateSourceTrigger=PropertyChanged}" DisplayMemberPath="city"
      SelectedValue="{Binding Order_City, UpdateSourceTrigger=PropertyChanged}" 
      SelectedValuePath="city" 
      IsEditable="True"/&gt;
  
  &lt;ComboBox Margin="0, 5" 
      ItemsSource="{Binding StationCollection, UpdateSourceTrigger=PropertyChanged}" 
      DisplayMemberPath="street" 
      SelectedValue="{Binding Order_Street, UpdateSourceTrigger=PropertyChanged}" 
      SelectedValuePath="street"/&gt;
  </code></pre>
  
  <p>ViewModel:</p>
  
  <pre><code> public string Order_Street
   {
        get { return _order_street; }
        set
        {
            _order_street = value;
            OnPropertyChanged("Order_Street");
            GetStations();
        }
    }
  
    public string Order_City
    {
        get { return _order_city; }
        set
        {
            _order_city = value;
            OnPropertyChanged("Order_City");
            GetStations();
        }
     }
  
      private void GetStations()
      {
          using (var entities = new MobilekEntities())
          {
              var stationList = entities.Stations.AsEnumerable();
  
              if (!string.IsNullOrEmpty(_order_city))
              {
                  stationList = stationList.Where(s =&gt; s.city.StartsWith(_order_city));
              } 
  
              if (!string.IsNullOrEmpty(_order_street))
              {
                  stationList = stationList.Where(s =&gt; s.street.StartsWith(_order_street));
              } 
  
              if (!string.IsNullOrEmpty(_order_streetNumber))
              {
                  stationList = stationList.Where(s =&gt; s.street.StartsWith(_order_streetNumber));
              }
  
              StationCollection = ToObservableCollectioncs.ToObservableCollection&lt;Station&gt;(stationList);
          }
      }
  </code></pre>
  
  <p>So it works nicely. It takes all Station and writes them into comboboxes, and when i choose a city, the streets only from that city are listed in streetCombobox.
  However when i want to change a city, there is only my chosen one. I made my comboboxes editable, so i wanted to backspace some letters, and then the list would be updated. Eg: I chose San Francisco, and when i backspace to San, there will San Jose appear in the list. Do u have any suggestion how to make it?</p>
  
  <pre><code>    public ObservableCollection&lt;Station&gt; StationCollection
      {
          get { return _stationCollection; }
          set { _stationCollection = value; OnPropertyChanged("StationCollection"); }
      }
  </code></pre>