У меня немного странное поведение, которое, похоже, не получается. Когда я повторяю элементы в свойстве ListBox.ItemsSource, я не могу получить контейнер? Я ожидаю, что ListBoxItem вернется, но я получаю null.
Любые идеи?
Здесь бит кода, который я использую:
this.lstResults.ItemsSource.ForEach(t =>
{
ListBoxItem lbi = this.lstResults.ItemContainerGenerator.ContainerFromItem(t) as ListBoxItem;
if (lbi != null)
{
this.AddToolTip(lbi);
}
});
В настоящее время ItemsSource установлен в словарь и содержит несколько KVP.