Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はListBoxいくつかのバインドされたオブジェクトを持っています。はListBox30 秒ごとに更新されます。ListBoxItem更新後にユーザーの選択を維持する方法は? ListBoxメソッドを使用して更新しClear()、オブジェクトを再度設定します。
ListBox
ListBoxItem
Clear()
うーん…クリアしたら…
object selection = myListBox.SelectedItem; myListBox.Clear(); myListBox.Items.AddRange(newItems); if (newItems.Contains(selection)) myListBox.SelectedItem = selection;