Hi,
In my Xamdatagrid I load certain data based on click of different buttons.
When I click the button after certain steps OnAssigningFieldLayoutToItem is called. In this function I made a function call to AddDynamicColumns. This function had following code:
for(int i=0;i<fields.Count;i++) {if (layout.Fields.Contains(fields[i])) { layout.Fields.Remove(fields[i]); } }
No the problem i when I load the data for the first time the code runs properly, but when I reload the loaded data in this case OnAssigningFieldLayoutToItem calls AddDynamicColumns and when this flow reaches layout.Fields.Remove(fields[i]); it again calls OnAssigningFieldLayoutToItem.
This way I am stuck in recursion between the two functions.
Kindly help.
Hello Neelesh,
Thank you for your post!
I have been looking into it and it seems that I am missing something from your scenario. Would you please provide me with more detailed information on the functionality you are using for the reloading the data in the XamDataGrid.?
If possible would you please provide me with a small sample application, showing the functionality you are using? This way I would be able to further investigate this issue for you.
Looking forward to hearing from you.
Hi Gergana,
Unfortunately I can't provide the code but just an overview.
I have created a layout manually for my use.
There is a panel with a tree structure. I click on any node and some data is loaded into the grid. For the first time when I click on the node after some calls the control reaches the function :: OnAssigningFieldLayoutToItem
in this function I have called another function AddDynamicFields.
In the AddDynamicFields function I am first removing few fields from the layout and then adding new fields.
When I first click a tree node the process is simple the control reaches AddDynamicFields in a loop the fields are removed and in another fields are added.
Now when I click the same node again, the problem arises. In this case the control first reaches OnAssigningFieldLayoutToItem and then AddDynamicFields. In AddDynamicFields when the control reaches :: layout.Fields.Remove(fields[i]); the OnAssigningFieldLayoutToItem is called again. This is creating problems for me.
Hope things are clear now.
I have been looking into your latest post and have created a small sample application, following the information you have provided.
Using this sample application I was not able to reproduce the issue. I am attaching it for your reference.
Would you please modify it with the functionality you are using, so it reproduces the issue? This way I would be able to further investigate this matter for you.