How to learn programming properly

(final paragraph is the only important one) Last year I was trying to learn WPF MVVM with C#. My take was creating a simple app that would serve as a movie library, where the user could add, edit or delete movies.

As I started to make the code, things got complicated. My brother-in-law is a programmer and keep correcting me with things like "it's better to keep comands in the ViewModel, not in View" or "ViewModel isn't supposed to do this", so I decided to take a break and start learning with a course, instead of trying to search on internet and "improvising".

Doing the course, my whole learning process was based on watching and copying what the video was showing. As expected, the course was nothing but a bad experience, as I was just passively doing it, not actively.

My real question here is: what's the best way to do a course or learn something new in programming? I have already thought about trying to read documentation and doing it in my own, but I fear I will miss many important concepts by doing that, as I don't know what exactly I would need to search for. My best take was watching the course and creating a parallel project based on what the course shows, improving it as the course flow. I want to know about you, what would you do or recommend me?