WPF How to create a grid that can scroll with static column and row header
<p>I have created a custom grid with a column and row header. The cells in the grid are empty. What I am trying to do is to create an excel like behavior for it in regards to scrolling. I need to add a horizontal and vertical scrollbar. When you scroll vertically I need the column header to stay in place and the row header to scroll. When you scroll horizontally I need the row column to stay in place and the column header to scroll. Here is the code I currently have for the grid:</p>

<pre><code>&lt;Canvas x:Name="canvas_blueprint" ClipToBounds="True" Width="{Binding ActualWidth, ElementName=canvas}" Height="{Binding ActualHeight, ElementName=canvas}"&gt;
            &lt;DockPanel&gt;
                &lt;Grid x:Name="grid_column_header" DockPanel.Dock="Top" Height="25" Width="{Binding ActualWidth, ElementName=canvas}"&gt;&lt;/Grid&gt;
                &lt;Grid x:Name="grid_row_header" DockPanel.Dock="Left" Width="25" Height="{Binding ActualHeight, ElementName=canvas}" Margin="0,-25,0,0"&gt;&lt;/Grid&gt;
                &lt;Grid x:Name="grid_blueprint" DockPanel.Dock="Right" Height="{Binding ActualHeight, ElementName=image_blueprint}" Width="{Binding ActualWidth, ElementName=image_blueprint}"&gt;
                    &lt;Grid.Background&gt;
                        &lt;ImageBrush x:Name="imagebrush_blueprint"/&gt;
                    &lt;/Grid.Background&gt;
                &lt;/Grid&gt;
            &lt;/DockPanel&gt;
        &lt;/Canvas&gt;
</code></pre>

<p>Basically it is a canvas with a dockpanel that contains 3 grids. 2 grids for the headers and 1 grid for the inside cells. The cells are created dynamically.</p>

<p>I am making a custom grid because I need to have a background image overlayed on the grid. I tried to use free spreadsheet controls, but have not found one that can have a background image. The only other behavior that my grid needs to have is the ability to select a cell, or a range of cells.</p>

<p>I have tried scrollbars and scrollviewers with the grid, but that makes the lines wonky and uneven. I'm not new to WPF programming, but I am nowhere close to expert. Any help would be appreciated.</p>