I'm trying to access UIElements in the VisualTree of a ListView but the ItemsCollection is empty even though the ListView IsLoaded, IsInitialized and has items in DataContext. 
How can I access UIElements in a ListView? Is there an event I can attach myself on to wait for开发者_开发问答 the items to be accessible?
Thanks
You can subscribe to ItemsContainerGenerator.StatusChanged and in the handler check whether the status is ContainersGenerated:
myListView.ItemContainerGenerator.StatusChanged += OnListViewItemsStatusChanged;
-
private void OnListViewItemsStatusChanged(object sender, EventArgs e) {
    if (myListView.ItemContainerGenerator.Status == GeneratorStatus.ContainersGenerated) {
        // access items
    }
}
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论