Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
225
Virtualization Problem
posted

I have a xamDataGrid which needs some custom UI controls overlaid on top of the grid. To that end, I have customized the template of the RecordListControl

<Style TargetType="{x:Type igDP:RecordListControl}" BasedOn="{StaticResource {x:Type igDP:RecordListControl}}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type igDP:RecordListControl}">
<Border Background="{TemplateBinding Background}">
<Grid >
<ScrollViewer
CanContentScroll="true"
Focusable="false"
HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}">
<my:CustomPanel>
<my:CustomControl1/>
<my:CustomControl2/>
<my:CustomControl3/>
<ItemsPresenter></ItemsPresenter> <!-- ItemsPresenter for the data grid ->
</my:CustomPanel>
</ScrollViewer>
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

Then, I implemented the necessary Measure and Arrange logic in my CustomPanel to arrange the custom controls on top of the ItemsPresenter in the way that I need. This is actually working pretty well, except I am having a problem that seems to be virtualization-related. Inside the ItemsPresenter, I am seeing one DataRecordPresenter for each item in the XamDataGrid ItemsSource. However, most (beyond the first few) of the DataRecordPresenter have actual size = 0. This is happening despite having AllowCellVirtualization="false" and AllowLabelVirtualization="false" in my FieldSettings and RecordContainerGenerationMode="PreLoad", RecordLoadMode="PreloadRecords", CellContainerGenerationMode="PreLoad", ScrollingMode="Immediate" properties in the XamDataGrid.

So I have a few questions. 1) Is this the right overall design to accomplish what I need to do? 2) How can I get all the DataRecordPresenters to be realized with correct height and width? Is the fact that my custom panel is not a ScrollViewer related to the problem I am facing?