Hi,
I have a XamDataGrid showing Orders. Orders have associated Tasks. I have these displayed hierarchically in a grid but due to the fact the data is being sent over a WCF service I want to Lazy Load the Tasks (child rows) to speed up the initial loading of the grid. I tried to do this by binding the Tasks via a property like so:
private List<TaskDTO> _tasks = null; public List<TaskDTO> Tasks { get { if (_tasks == null) _tasks = GetTasks(OrderId);
return _tasks; } }
However when I hit the plus sign to expand the Child Rows it looks like it is going to expand and then doesn't. The plus sign turns to a minus sign but with no data in there.
I have checked data is actually returned from the service and is placed into the _tasks variable.
The above property also only seems to be evaluated the first time I hit the plus (I guess this is some kind of caching in the xamDataGrid).
Is there a better way of trying to lazy load the child rows or am I missing something with how I am trying to implement it?
Cheers,Dave
Hello David,
Thank you for your post.
I have been looking into your issue. I have created a small sample application in order to test this functionality. In the sample application I am using a simple method, called GetData, where I am populating the Task collection. I have used this method in order to simulate the usage of WCF service.
The WCF service is loading the data asynchronously and this behavior might be causing the issue. In the sample application I have added a BackgroundWorker to simulate this behavior and I was able to reproduce the issue.
This issue can be fixed by added a PropertyChanged method to the Task property. I am attaching the sample application I have been testing with for your reference.
Please find the attached sample application and feel free to let me know if you have any further questions on this matter.
Excellent. Thank you for your help. All working now!
Hello bsinternet,
Thank you for your feedback. I am glad I was able to help.