In my WPF application I have ItemsControl which has ZoomableCanvas as Panel which provides the Virtualization mechanism for the Canvas. This is working perfectly. This Canvas needs to have a Graph like background. When I use the xaml below, the grid is generated but only to the extent of the Viewport (at load time). So when scrolled you see the background grid getting clipped vertically and horizontally. In the performant-virtualized-wpf-canvas this was handled by adding child Visuals to the canvas as Backdrop.
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<ZoomableCanvas x:Name="ZCanvas" Loaded="ZoomableCanvas_Loaded" >
<ZoomableCanvas.Background>
<DrawingBrush TileMode="Tile" Stretch="Fill"
Viewport="0 0 100 60" ViewportUnits="Absolute"
ViewboxUnits="Absolute" >
<DrawingBrush.Drawing>
<GeometryDrawing Geometry="M0,0 L0,1 0.03,1 0.03,0.03 1,0.03 1,0 Z" Brush="Gray" />
</DrawingBrush.Drawing>
</DrawingBrush>
</ZoomableCanvas.Background>
</ZoomableCanvas>
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
To elaborate on the problem: Please see these images:
On Load --- the background grid is visible and the Left of the child is quite far off from 0,0
On Scrolling Right and back -- the background grid is clipped and the child appears to start from leftmost point in Canvas
How can we have a Grid background which stretches the entire width of ZoomableCanvas ? And How do we fix the On Scroll issue?
Any help / hints sincerely appreciated.