public SetResult TrySet(string value) { if (!DoesApply()) { return(SetResult.NotApplicable); } if (value.Equals(SelectValue, StringComparison.OrdinalIgnoreCase)) { if (_canSelectMultiple) { _selectionItemPattern.AddToSelection(); } else { _selectionItemPattern.Select(); } return(SetResult.Success); } if (!string.IsNullOrEmpty(value)) { return(SetResult.Failure); } _selectionItemPattern.RemoveFromSelection(); return(SetResult.Success); }