Article about using a ViewModel with the WPF TreeView

In a surge of Mahler-inspired geekery, I wrote and published what I consider to be one of my best WPF articles. If you have ever thought that the WPF TreeView is too complicated and doing anything non-trivial with it is difficult, think again! Over the past few days I have been solidifying my TreeView programming techniques, thanks to an invigorating e-mail thread with Sacha Barber, and it all culminated in this article:

http://www.codeproject.com/KB/WPF/TreeViewWithViewModel.aspx

My favorite paragraph from the article:

WPF is great because it practically requires you to separate an application’s data from the UI. All of the problems listed in the previous section derive from trying to go against the grain and treat the UI as a backing store. Once you stop treating the TreeView as a place to put data, and start treating it as a place to show data, everything starts working smoothly. This is where the idea of a ViewModel comes into play.

Enjoy!

6 Responses to Article about using a ViewModel with the WPF TreeView

  1. Hi Josh,
    thanks so much for this super article. I am struggling with MVVM, TreeView all the time.

    All best for you!

  2. Josh Smith says:

    Thanks, I’m glad you found it helpful! 😀

  3. Josh,
    I think that is the secret to smoothing out WPF’s steep learning curve. Once I realized that key bit of information, it all fell into place for me.

  4. Josh Smith says:

    I know what you mean, Mike. It’s like you finally discover how easy it is, after all the frustration and hordes of unnecessary details soak into your brain.

  5. Alexey Potapov says:

    Josh,
    Thanks for the great article – this is the one that made the whole thing of MVVM pattern clear for me, finally.

    >> …after all the frustration and hordes of unnecessary details soak into your brain.
    I’d disagree with the “unnecessary”. I think it’s that knowledge about details, that allows you to get to the point when you can enjoy the ‘easy’ness.
    Once you’re there these details do become unnecessary though🙂

  6. Josh Smith says:

    Good point, Alexey. 🙂

%d bloggers like this: