Hi all, I have a listview control which is binded with gridview columns binded to cell template with static resource. my listview is bounded to a list of class objects as itemssource.i am trying to get all the items using the below code. GridView gridView = lvView.View as GridView; foreach (TicketExceptions item in lvView.Items) { VirtualizingStackPanel vsp = (VirtualizingStackPanel)typeof(ItemsControl).InvokeMember ("_itemsHost", BindingFlags.Instance | BindingFlags.GetField | BindingFlags.NonPublic, null, lvView, null); double scrollHeight = vsp.ScrollOwner.ScrollableHeight; double offset = (scrollHeight * lvView.Items.IndexOf(item)) / lvView.Items.Count; // itemIndex_ is index of the item which we want to show in the middle of the view vsp.SetVerticalOffset(offset); lvView.ScrollIntoView(item); ListViewItem item1 = lvView.ItemContainerGenerator.ContainerFromIndex(lvView.Items.IndexOf(item)) as ListViewItem; // item1 returns null for few items GridViewRowPresenter rowPresenter = GetFrameworkElementByName<GridViewRowPresenter>(item1); foreach (PropertyInfo info in item.GetType().GetProperties()) { for (int col = 0; col < colcount; col++) { if (rowPresenter != null) { ContentPresenter templatedParent = VisualTreeHelper.GetChild(rowPresenter, col) as ContentPresenter; TextBlock block = (TextBlock)gridView.Columns[col].CellTemplate.FindName(info.Name, templatedParent); if (block != null) { } } } } But the ItemContainerGenerator returns null for few items. when i checked, i see that only the items which are in visible in the listview (rather than scrolling) returns object using the above method, but others return null. i am able to see all the items in the listview. How can i get the container of the items without scrolling.
Thanks in advance.:) Regards Anuradha