Microsoft Developer Network > Página Inicial dos Fóruns > Windows Presentation Foundation (WPF) > When does ItemsControl.ItemContainerGenerator generate ListBox items?
Fazer uma PerguntaFazer uma Pergunta
 

RespondidoWhen does ItemsControl.ItemContainerGenerator generate ListBox items?

  • sexta-feira, 3 de julho de 2009 21:06knji Medalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuárioMedalhas de usuário
     
    I have a ListBox that is initially Collapsed.  When a user clicks on a checkbox, the ListBox becomes Visible.  I want to programmatically select items the user had selected before when the ListBox is Loaded or becomes Visible.

    However, the ItemsContainerGenerator is returning null for this data items, container, unless the ListBox was not initially Collapsed.

    I have tried selecting the ListBox items programmatically within the Loaded and IsVisibleChanged event handlers but ItemsContainerGenerator is still returning null.

    Any other suggestions?

    TIA.

Respostas

Todas as Respostas