SearchHandler.OnQueryChanged(String, String) 메서드

정의

개발자는 수정되는 Query에 응답하도록 이 메서드를 재정의할 수 있습니다.

protected virtual void OnQueryChanged (string oldValue, string newValue);
abstract member OnQueryChanged : string * string -> unit
override this.OnQueryChanged : string * string -> unit

매개 변수

oldValue
System.String
newValue
System.String

설명

일반적인 사용 사례는 사용자가 데이터를 입력할 때 제안 집합을 수정하는 것입니다.

protected override void OnQueryChanged(string oldValue, string newValue)
{
    base.OnQueryChanged(oldValue, newValue);
    if (string.IsNullOrWhiteSpace(newValue))
    {
        ItemsSource = null;
    }
    else
    {
        ItemsSource = MonkeyData.Monkeys
            .Where(monkey => monkey.Name.ToLower().Contains(newValue.ToLower()))
            .ToList<Animal>();
    }
}

적용 대상