Here's what I've tried first:

Cells of the leftmost column get same height as other row cell since they all belong to the same Grid BUT when I scroll to the right the left most column gets hidden eventually. I want that column to stay on the left always like the freeze pane of Excel. Is it possible with a single Grid?
Here I've tried with two Grid:

BUT I couldn't fix the row height problem in the left grid. Tried to bind the Grid.Height and RowDefinition.Height of the left grid to those of the grid inside the ScrollViewer on the right BUT that didn't work. You can have these in the MainWindow.xaml:
<Grid x:Name="main">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<ScrollViewer x:Name="scr"
Grid.Column="1"
VerticalScrollBarVisibility="Auto"
HorizontalScrollBarVisibility="Auto"/>
</Grid>
and these in MainWindow.xaml.cs:
public partial class MainWindow : Window
{
public MainWindow() {
InitializeComponent();
var sideGrid = new Grid() { ShowGridLines = true };
var scrollGrid = new Grid() { ShowGridLines = true };
//sideGrid.SetBinding(Grid.HeightProperty, new Binding("ActualHeight") { Source = scrollGrid, Mode = BindingMode.OneWay });
for (int i = 0; i < 9; i++) {
var rf1 = new RowDefinition();
var rf2 = new RowDefinition();
scrollGrid.RowDefinitions.Add(rf1);
sideGrid.RowDefinitions.Add(rf2);
//rf2.SetBinding(RowDefinition.HeightProperty, new Binding("ActualHeight") { Source = rf1, Mode = BindingMode.OneWay });
scrollGrid.ColumnDefinitions.Add(new ColumnDefinition());
}
for (int i = 0; i < 9; i++)
scrollGrid.ColumnDefinitions.Add(new ColumnDefinition());
for (int i = 1; i < 9; i++) {
var sideText = new TextBlock() {
Text = "Row " + i,
Margin = new Thickness(0, 0, 20, 0),
VerticalAlignment = VerticalAlignment.Center
};
Grid.SetRow(sideText, i);
sideGrid.Children.Add(sideText);
}
main.Children.Add(sideGrid);
for (int i = 0; i < 19; i++) {
var headBlock = new TextBlock() {
Text = "Form " + i,
FontSize = 20,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
Grid.SetColumn(headBlock, i);
scrollGrid.Children.Add(headBlock);
for (int j = 1; j < 9; j++) {
var content = new TextBlock() {
Text = $"Row {j} Column {i}",
FontSize = 20,
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center,
Margin = new Thickness(10, 0, 10, 0)
};
Grid.SetColumn(content, i);
Grid.SetRow(content, j);
scrollGrid.Children.Add(content);
}
}
scr.Content = scrollGrid;
}
}
for testing. One more thing How to hide the grid lines on cell that spans multiple Row/Colum?




