Team,
I have a silverlight grid and enabled the GroupBy feature. One of the column in the grid is a textbox field which allows user to modify the value. There is a save button from the page for user to save the changes.
However, when user does the column groupby, expand one of the grouped row, then make some changes to the value and click on the save button. After the button clicked, the expanded group row is now collapsed. Is there a way we can keep the expanded row expand after the button click event?
Thanks for any advice.
Chris
Hello,
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.
thanks, it works!
You can iterate XamGrid’s Rows and create the array with the IsExpanded states like this:
bool[] isExpandedArray = new bool[xamGrid1.Rows.Count]; for (int i = 0; i < xamGrid1.Rows.Count; i++) { if (xamGrid1.Rows[i].IsExpanded) { isExpandedArray[i] = true; } else { isExpandedArray[i] = false; } }
Hope this helps you.
Yes, rebind the whole ItemsSource of the XamGrid. Mind to tell me while I have it iterating, how can I retrieve the information of the Expand state? It would be great if you have some code snippet on how to do that. Greatly appreciated it!
Could you please be more specific what is the code you use here:
// rebind the record to the XamGrid
// rebind code goes here
Do you mean that you rebind the whole ItemsSource of the XamGrid, because if you do so, it is expected that the Rows are collapsed and the thing you could do is iterating them before saving and save their Expand state in an array for example and after that iterate them again and set their expand state.
Looking forward for your reply.