1

私のwp7アプリケーションには、検索テキストボックスでキーを押すたびにリストコレクション(連絡先リストなど)で部分一致検索(複数のフィールドが名と姓を言う)を実行し、リストボックスにバインドする必要があるという要件があります。texchanged イベントで結果を取得する linq クエリを作成しました。期待どおりの結果が得られていますが、コレクションに 500 を超えるアイテムがある場合、応答が遅くなります。

以下のコードを投稿しました。誰かがパフォーマンスの問題を調整するのを手伝ってくれれば、本当に感謝しています。

private void TechChanged(object sender, TextChangedEventArgs e)
{
    IList<Contacts> results = searchcontList
            .Where(tb => tb.SearchText.Contains(textsearch.Text))
            .ToList();

    //"SearchText" is an attribute in contacts class which is concatination values of all the fields in contacts class
    listcontact.ItemsSource = results;
}
4

1 に答える 1