Marcus Mondel
Marcus Mondel

Reputation: 718

Is there a way to produce a scrollable gridlayout with dynamic content?

Ì 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.

Layout grid in a scrollview

Upvotes: 0

Views: 62

Answers (1)

Mark Feldman
Mark Feldman

Reputation: 16148

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>

Upvotes: 1

Related Questions