Ì want to write a software where there is a grid layout inside a scrollview. I already hardcoded it, but I think I need to find a solution to make this dynamic! How can I manage to do this! I am pretty new to C# and WPF. I post a screenshot and my code so you can see what I am trying to achieve.
Asked
Active
Viewed 47 times
0
-
1You need an `ItemsControl` with a `Grid` as its `ItemsPanel`. See this post: https://stackoverflow.com/q/9000549/366064 – Bizhan Dec 24 '18 at 17:47
1 Answers
1
DataGrid is probably the best thing to use here, although you can also do it with a ListView using a GridView as the view:
<ListView ItemsSource="{Binding Items}">
<ListView.View>
<GridView>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Name}" />
<GridViewColumn Header="Age" DisplayMemberBinding="{Binding Age}" />
<GridViewColumn Header="Gender" DisplayMemberBinding="{Binding Gender}" />
</GridView>
</ListView.View>
</ListView>

Mark Feldman
- 15,731
- 3
- 31
- 58