Hi. I have a grid with a DataTable as its ItemsSource. I need to answer the question: What DataTable rows are left if I apply a bunch of saved filters to this DataTable ? So I'm trying to:
public List<
DataRow
> GetList(DataTable dt)
{
DataTable myTable = DupTable(dt);
RadGridView myGrid = new RadGridView() { ItemsSource = myTable, Visibility = Visibility.Visible, EnableRowVirtualization=false };
myGrid.Filtered += new EventHandler<
GridViewFilteredEventArgs
>(myGrid_Filtered);
myGrid.Items.CollectionChanged += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(Items_CollectionChanged);
foreach (ColumnFilterDescriptor fd in myfilters)
myGrid.FilterDescriptors.Add(fd);
IList<
GridViewRow
> list = myGrid.ChildrenOfType<
GridViewRow
>();
List<
DataRow
> results = new List<
DataRow
>();
foreach (GridViewRow gvr in list)
results.Add(gvr.Item as DataRow);
return results;
The problem with this approach is that myGrid.ChildOfType<GridViewRow> is returning empty and I don't know why that is. I've been playing with visibility and virtualization trying to get some data back but no success. Using the collection changed event I can see that the data are going into the grid and being filtered correctly... I just need to get the DataRows back out of the grid...
Can somebody please tell me why myGrid.ChildrenOfType<GridViewRow> might be empty ?
Thank you -
Scott