namespace System.Activities.Presentation.PropertyEditing { using System; using System.Globalization; using System.Runtime; using System.Activities.Presentation; /// /// Represents a predicate for search/filtering /// [Fx.Tag.XamlVisible(false)] public class PropertyFilterPredicate { private string _matchText; /// /// Creates a PropertyFilterPredicate. /// /// /// When matchText is null public PropertyFilterPredicate(string matchText) { if (matchText == null) throw FxTrace.Exception.ArgumentNull("matchText"); _matchText = matchText.ToUpper(CultureInfo.CurrentCulture); } /// /// Gets the string predicate /// protected string MatchText { get { return _matchText; } } /// /// Returns true if a case insensitive match of the predicate string is contained /// within the target string. /// /// The string filter /// public virtual bool Match(string target) { return target != null && target.ToUpper(CultureInfo.CurrentCulture).Contains(_matchText); } } }