1 namespace System.Activities.Presentation.PropertyEditing {
3 using System.Globalization;
5 using System.Activities.Presentation;
8 /// Represents a predicate for search/filtering
10 [Fx.Tag.XamlVisible(false)]
11 public class PropertyFilterPredicate
13 private string _matchText;
16 /// Creates a PropertyFilterPredicate.
18 /// <param name="matchText"></param>
19 /// <exception cref="ArgumentNullException">When matchText is null</exception>
20 public PropertyFilterPredicate(string matchText) {
21 if (matchText == null)
22 throw FxTrace.Exception.ArgumentNull("matchText");
24 _matchText = matchText.ToUpper(CultureInfo.CurrentCulture);
28 /// Gets the string predicate
30 protected string MatchText {
37 /// Returns true if a case insensitive match of the predicate string is contained
38 /// within the target string.
40 /// <param name="target">The string filter</param>
41 /// <returns></returns>
42 public virtual bool Match(string target) {
43 return target != null && target.ToUpper(CultureInfo.CurrentCulture).Contains(_matchText);