I want to create a completely dynamic data matrix. For eg,
Column1 Column2 Column3....
id1 id11 id12 id13...
id2 id21 id22 id2
You could probably use my answer to this Question. It's a subclassed DataGrid used to display, edit and databind 1D or 2D arrays and lists of dynamic size. It can be downloaded from here.
Say you have this 2D array of strings as a Property
public string[][] String2DArray { get; set; }
then you can bind it to the DataGrid2D by adding a reference to the DataGrid2DLibrary.dll and add the namespace
xmlns:dg2d="clr-namespace:DataGrid2DLibrary;assembly=DataGrid2DLibrary"
<dg2d:DataGrid2D Name="c_dataGrid2D"
UseModifiedDataGridStyle="True"
ItemsSource2D="{Binding String2DArray}"/>
And the Output will look like this
This article mainly shows how to bind a WPF ListView to a DataMatrix (an undefined data source with dynamic columns) where the ListView columns cannot be determined until runtime.
http://www.codeproject.com/KB/WPF/WPF_DynamicListView.aspx
You can try this article on Binding a ListView to a DataMatrix
Yeah, it sounds like you could make very good use of the <Grid>
tag. So, to replicate your example:
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
<RowDefinition Height="25" />
</Grid.RowDefinitions>
<TextBlock Grid.Column="1" Grid.Row="0">Column1</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="0">Column2</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="0">Column3</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="1">id1</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="1">id11</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="1">id12</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="1">id13</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="2">id2</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="2">id21</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="2">id22</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="2">id23</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="3">.</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="3">.</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="3">.</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="3">.</TextBlock>
<TextBlock Grid.Column="0" Grid.Row="4">.</TextBlock>
<TextBlock Grid.Column="1" Grid.Row="4">.</TextBlock>
<TextBlock Grid.Column="2" Grid.Row="4">.</TextBlock>
<TextBlock Grid.Column="3" Grid.Row="4">.</TextBlock>
</Grid>
You can also use the WPF datagrid, available in WPF 4.0. If you cannot use the 4.0 Framework, than you still could use the datagrid under the codeplex release for .NET 3.5 SP1. See WPF Toolkit
You could also use the ListView, yes. WPF is very flexible, so you have a lot of choices. Program Grid tags as above, or use a datagrid or listBox or listView with an ItemSource set on the 3 latter choices.