Hi,
I was trying to change the default behaviour of the pivot grid (Expand the rows and columns) by
default you have to expand the "+" sign to see al lthe data.
I can't seem to find a way to do this. Is there a way of making all the rows and columns expand?
I noticed on the samples that when using a flat data source the rows and columns are expanded
but i couldn't see how this was done.
Thanks.
Hi
There are two ways to expand hierarchy from code behind.
The first one is to work with HeaderCells. The second one is to work with filter tree. The filter tree is related with visualizated hierarchy and when you expand/collapse node in tree the grid automaticaly update and header hierarchy.
For first one you can use the follow code
public EmptyPage()
{
InitializeComponent();
pivotGrid.LayoutLoaded += pivotGrid_LayoutLoaded;
}
void pivotGrid_LayoutLoaded(object sender, EventArgs e)
foreach (PivotHeaderCell cell in pivotGrid.GridLayout.ColumnHeaderCells)
if (cell.IsToggleVisible && cell.IsExpanded == false)
cell.IsExpanded = true;
return;
For second approach you can read this article
Regards
Todor
Thanks for yourhelp. I used your example and what I did was place a backgrpound worker in the layout loaded methods to expand all the columns etc because the UI bvecame unresponsive. It did help a little but the UI is still pretty slow and only goes back to "normal" once ythe grid has been fully expanded. I put a breakpoint at the layout loaded event and it seems that the methods is also called 3 times (I'm assuming for the 3 fields I pret the grid with.
Ideally I would only like to call this method once all the fields have been loaded. so is there a better method I can place the code on so that once grid has received all the preset field then I can update the columns anbd rows to expand?
Thanks again.
Pritesh
bump, same question
Hello, masterianvii,
As of 12.2 you can use the ExpandToLevelAsync method that the DataSourceBase class exposes. You can see a sample demonstrating how to use this method here.
Let me know if this is the functionality you want to achieve or if you need any further help.
Regards,
Philip
Thanks!