Click here to Skip to main content
15,510,483 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Sample	Data verification				
	1	2	3	4	5
4	data1	data2	data2	data3	data3
3		test	data2	data3	data3
2	Sample		test	data3	data3
1				test	data3


What I have tried:

<ItemsControl ItemsSource="{Binding Path=TableHeaders}" Grid.Column="1">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="100" />
                                    <ColumnDefinition Width="20" />
                                </Grid.ColumnDefinitions>
                                <TextBlock Grid.Column="0" Grid.ColumnSpan="2" TextAlignment="Center" Text="New" />
                            </Grid>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel  Orientation="Horizontal"/>
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                </ItemsControl>
                <TextBlock Grid.Column="2" TextAlignment="Center" 
  Text="1" FontWeight="Bold" />
                <TextBlock Grid.Column="3" TextAlignment="Right" 
  Text="2" FontWeight="Bold" />
            </Grid>
Posted
Updated 21-Jun-21 22:11pm
Comments
Maciej Los 22-Jun-21 2:30am    
And... What's wrong with your XAML/code?
Adérito Silva 31-Jul-21 16:43pm    
The ListView should work nicely, but if you require the use of an ItemsControl, you may consider the HierarchicalDataTemplate. By representing data hierarchically, you can then use StackPanels acting as rows and have each of its items sized independently (acting as columns). For this, you would need a way of knowing what items go where (to a new row or to the next column?), but a table is a two-level hierarchy anyway, so it should be feasible. You won't need a grid.

1 solution

You could use GridViewColumns? But why not just use a normal WPF ListView with GridViewColumns then?
 
Share this answer
 
Comments
Gokulnath007 22-Jun-21 9:48am    
Need to use ItemsControl and Grid to complete this process.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900