Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>One method would be to use a Value Converter if you want to do data binding to the ObservableCollection.</p> <p>Another method would be to use LINQ in a ViewModel CLR object that would do the filtering based on properties in the ViewModel like this (see the implementation method UpdateFilteredStores() at the bottom):</p> <pre><code>namespace UnitTests { using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; using System.ComponentModel; using System.Linq; public class ViewModel : INotifyPropertyChanged { private string name; public ViewModel() { this.Stores = new ObservableCollection&lt;string&gt;(); this.Stores.CollectionChanged += new NotifyCollectionChangedEventHandler(this.Stores_CollectionChanged); // TODO: Add code to retreive the stores collection } #region INotifyPropertyChanged Members public event PropertyChangedEventHandler PropertyChanged; #endregion public ObservableCollection&lt;string&gt; Stores { get; private set; } public IEnumerable&lt;string&gt; FilteredStores { get; private set; } public string Name { get { return this.name; } set { this.name = value; if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs("Name")); } this.UpdateFilteredStores(); } } private void Stores_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e) { this.UpdateFilteredStores(); } private void UpdateFilteredStores() { this.FilteredStores = from store in this.Stores where store.Contains(this.Name) select store; if (this.PropertyChanged != null) { this.PropertyChanged(this, new PropertyChangedEventArgs("FilteredStores")); } } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload