The problem begins at this post: Using binding to a List<UserControl> how can I do for not showing the controls
I was designing something like this:
List<Container>
(Below container properties)
- Objective: string
- Problems: List<ProblemUserControl>
ProblemUserControls is a UserControl where contais an extra property called Problem. But the above post a person suggest me use MVVM Pattern. I’m investigating but, I’m still confused or I need a little of help to understand the pattern in WPF.
Here is a example to illustrate using MVVM. Note that there is no need to have a list of usercontrols and indeed this would be considered incorrect from an MVVM viewpoint.
This is based on the default WPF application template in Visual studio.
Here are the classes involved.
And the main window. Note that I’ve commented out your rectangle to show the bindings
MainWindow.cs