Hi,
I have a XamPivotGrid that takes its data from an xml. this xml has a date, a brand and two values (msvalue and msvolume). i have created a radiobutton that toggles between the msvalue and the msvolume data.
my brands are the rows and the dates represent the columns.
if i filter my brands by using the "FilterDropdownToggle" to two brands for example, the grid works correctly. however, when i toggle between the two options in the radiobutton my filter brand is reset and doesn't store what was chosen before in my case (the two brands).
In the toggle we are giving the grid everytime its new Itemsource after the change in the radio button. and so everytime the user changes between msvalue or msvolume, it redraws the grid and resets whatever options we have chosen.
How can we fix that so that the grid is not redrawn everytime and the filter list is stored.
Thanks,
Nazha
Hello Nazha,
Thank you for your feedback. I am glad that you resolved your issue and I believe that other community members may benefit from this as well.
Thanks again.
Hello Stefan,
Yes it worked out.
Thank you,
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
I have been looking into your requirement and the code you have provided and I suggest you use the following code instead of yours:
private void pivotGrid_LayoutLoaded(object sender, EventArgs e) { if (pivotGrid.GridLayout.RowHeaderCells[0] != null && this.pivotGrid.DataRows.Count > 1) { // setting the RowHeaderCells Column Width pivotGrid.GridLayout.RowHeaderCells[0].Column.ColumnWidth = (maxbrandwidth < 120 ? 120 : maxbrandwidth > 200 ? 200 : maxbrandwidth); // setting the DataColumns Column Width PivotColumnsPanel obj = GetObject(this.pivotGrid, "ColumnsHeaderPanel") as PivotColumnsPanel; obj.SizeChanged += new SizeChangedEventHandler(obj_SizeChanged); if (obj.RenderSize.Width > 0) { if (nbmonths <= 12) { if (obj.RenderSize.Width > 0) { double columnWidth = obj.RenderSize.Width / nbmonths; for (int index = 0; index < pivotGrid.DataColumns.Count; index++) { pivotGrid.DataColumns[index].ColumnWidth = columnWidth; } } } else { if (obj.RenderSize.Width > 0) { for (int index = 0; index < pivotGrid.DataColumns.Count; index++) { pivotGrid.DataColumns[index].ColumnWidth = (int)obj.RenderSize.Width / 12; } } } } } } void obj_SizeChanged(object sender, SizeChangedEventArgs e) { PivotColumnsPanel colheaderpanel = (PivotColumnsPanel)sender; if (colheaderpanel.RenderSize.Width > 0) { for (int index = 0; index < pivotGrid.DataColumns.Count; index++) { pivotGrid.DataColumns[index].ColumnWidth = (int)colheaderpanel.RenderSize.Width / 12; } } }
Basically I rounded the Widths to integer, so the lines can redraw correctly. Please let me know if this helps you or you need further assistance.
Looking forward for your reply.
Sorry didnt attach the photo in my previous message.