I’ve placed a XamDataGrid with both Height & Width set to Auto and the MaxHeight and MaxWidth set to Infinity inside a UserControl Object, That is itself placed as a Child of a WrapPanel in a ScrollDoc object. I then format and add multiple rows of Data programmatically to the XamDataGrid.
I discovered that after a relatively small number of rows the XamDataGrid automatically creates a ScrollBar, and doesn’t display all the records. My Clients want one scroll bar for all records with none hidden;
So I then set the Max Height to a large value (in this case 100,000) and while this forced the data grid to display fully, it then however lead to an issue of Out of Memory Exceptions being thrown with all my windows in the program being deleted and redrawn in no particular order;
In this instance there were 56 XamDataGrids and 8557 rows between all of them.
Is there a way to Display all the rows within the XamDataGrids like my Client wants, without causing Out of Memory Exceptions?
Hello,
I am sorry, I did not understand your scenario completely. I am not sure why you set MaxHeight/MaxWidth as well as Height and Width properties, as they are set to Infinity by default. According to your description, both the XamDataGrid and the ScrollViewer have scrollbars?
I also do not see a reason why the OutOfMemoryException is thrown. Have you set the RecordContainerGenerationMode to PreLoad?
If you have a mock application that reproduces the scrollbar issues, please attach it to your next post, or a screenshot.
Thanks.
I guess I skipped a few things, so sorry about that. In my program the XamDataGrid can be variable size but I need them to display all records without a scroll bar; this is because the old (10+ year old) program that is being rewritten just uses a text field to show all the data and the users want it to mimic that. So the program go to a loads each XamDataGrid with in a UserControl and slaps that into a scrolldoc to mimic the behavior. Well if I leave the max height at Infinity, then the XamDataGrid wants to scroll no matter what, the one way I found to force it to not scroll is to set the MaxHeight to a very large number. If I set it to a very large number I then get the Out of Memory with large data sets.
I have tried the following combinations on my grid:
RecordLoadMode="LoadOnDemand/ PreloadRecords " RecordContainerGenerationMode="Virtualize/ LazyLoad / Recycle / PreLoad " MaxHeight="100000" =FAIL with big data sets, but works the way my users want.
RecordLoadMode="LoadOnDemand/ PreloadRecords " RecordContainerGenerationMode="Virtualize/ LazyLoad / Recycle / PreLoad " MaxHeight=" Infinity " =Loads, but does not work in the way my users want.
The screenshot if I do not set RecordLoadMode="PreloadRecords" RecordContainerGenerationMode="PreLoad" MaxHeight="Infinity"