I have a WPF Form with a such a layout:
<Grid>
<DataGrid>
...
</DataGrid>
<Canvas>
...contains lines created at runtime...
</Canvas>
</Grid>
You can see I have a DataGrid where I load files into.
Some of the cells of the Datagrid are getting connected by Lines. These Lines are placed into the canvas. That all works really fine.
But now I have one big problem. I can disable all lines not to go over my whole form by z-index. The only area where they are when I scroll down is the DataGridColumnHeader.
Do you have any idea what i could do that the lines have a lower z-index then my DataGridColumnHeader but a bigger or the same as my DataGridCells?
You cannot solve this problem by means of setting a ZIndex, since this index only controls the z-order of elements inside one Panel.
You can however set the Canvas’s Margin so that it does not cover the DataGridColumnHeader and then set its ClipToBounds property to true.
I haven’t tested the XAML above, but it should work.