Hi
I have a datatemplate with Expander control containing XamPivotGrid inside the PivotCell of the XamDatagrid.
Our requirement was to show two different types of controls in the XamPivotGrid PivotCells which I have implemented using the OnCellControlAttached event.
Now when scrolling is done for the XamPivotGrid, this OnCellControlAttached event again is raised may be due to virtualization.
Due to this raised event, the expander control is collapsed and the selected row in the xamdatagrid which is present in the PivotCell is lost.
What I need is that if there is any way by which the OnCellControlAttached event not to get raised for the already loaded PivotCells (may be to stop the virtualization for already loaded cells). This way my functionality of selections in the PivotCell would not get lost.
If anyone has understood above please help with a sample.
Thanks, Rakesh Bisht
Hello Rakesh,
You are right about the OnCellControlAttached event, in that it will fire multiple times due to virtualization. As new cells are scrolled into view, they have controls attached to them. This is when the event is fired. The only way to stop this event would be to disable virtualization on the XamPivotGrid, and I'm pretty sure that it can't be turned off, nor would you want it off as it could introduce major performance issues.
Can you provide me with the DataTemplate you are using, and the code you have in OnCellControlAttached? So I can build a sample using it to replicate your issue.
Hello Rob,
Thanks for your reply.
I have modified one of the samples with implementing my current requirement(control template) and attached the same.
In the sample if you click and expand any of the expander control, a xamdatagrid is displayed with sample data.
And now if you click any of the record in the XamDatagrid you have some selection set by User.
At this moment if User scrolls the XamPivotGrid and the previously selected PivotCell goes out of view, then the selection of the child xamdatagrid is lost.
Request you to please suggest any workaround if any.
Thanks Rakesh