ItemContainerGenerator.Status: Where is it now? RRS feed

  • Question

  • I am trying to use the VisualTreeHelper, and I have no problem with that - except that ContainerFromIndex and ContainerFromItem keep returning Nothing. First of all, pretty much all sites that I could find tell me to use something like:



    StatusChanged event

    However, MyItemsControl.ItemContainerGenerator.ContainerFromIndex is deprecated for MyItemsControl.ContainerFromIndex. I can go with that, just shorter code, seems to work the same. But the Status property and StatusChanged event are nowhere to be found. I tried to use the LayoutUpdated event, but it did not solve all my problems. I need to be able to use the VisualTreeHelper because a large amount of my code relies on the Checked event of the RadioButton, but in order to use the VisualTreeHelper, I need ContainerFromIndex to work, and I have been unable to find a reliable way to do that (it often returns Nothing). If the Status property and StatusChanged event are missing, what is the best way to know when it is safe to use ContainerFromIndex? Thanks.

    Nathan Sokalski njsokalski@hotmail.com http://www.nathansokalski.com/

    Thursday, January 8, 2015 5:18 AM


  • Hi,           

    ItemContainerGenerator.Status and StatusChanged event are not available in windows store app. Please see the link to know which property or event can used in ItemContainerGenerator class:


    The MyItemsControl.ContainerFromIndex return null because of the items in MyItemsControl have not been generate yet. The reason is the UI virtualization:


    I recommend you can change the control’s ItemsPanelTemplate to a none virtualizing control like stackPanel:

                        <StackPanel Orientation="Horizontal"/>
    Best Wishes for you!

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. <br/> Click <a href="http://support.microsoft.com/common/survey.aspx?showpage=1&scid=sw%3Ben%3B3559&theme=tech"> HERE</a> to participate the survey.

    Friday, January 9, 2015 5:59 AM