Click here to Skip to main content
14,971,029 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to achieve certain thing, and I have troubles finding solution.

I will describe it on an example. I have ObservableCollection of type Person. Lets say Person has two properties: string Name, and int Age.

I can easily display such collection in DataGrid, but I want something more fancy. I have an idea to create custom layout with UserControl, but I have absolutely no idea how to display each Person on separate UserControl, inside scrollable list.

I think I have provided enough information, and I'm basically asking for xaml and cs code of a window that does that thing. I can then expand it to actual thing I want to do.

Thank you in advance.

What I have tried:

I was unable to try anything If I don't know how to achieve it.
Updated 1-Mar-21 9:13am
George Swan 1-Mar-21 13:55pm
You need to provide an item data template for your list; here is an example

1 solution

The easiest way to do this is using an ItemsControl:
ItemsControl Class (System.Windows.Controls) | Microsoft Docs[^]

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