Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 85383
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:04:51+00:00 2026-05-10T22:04:51+00:00

I am working on a WPF application which has a treeview that represents an

  • 0

I am working on a WPF application which has a treeview that represents an XML. I load the XML on to the XDocument, then bind the TreeView to this object.

Now using the MVVM pattern, I want to provide a ViewModel on top of XDocument. What are some of the things that I should implement in the ViewModel class.

I am thinking of,

  1. RoutedCommands that bind to ContextMenu commands on the TreeView to allow add node, remove node, modify node etc
  2. Logic to actually modify attributes and nodenames on the view.

Am I going in the right direction? What else should I do to make it cleaner, modular at the same time easy to understand.

Should I use RoutedCommands or implement ICommand interface and create my commands? How about using attached properties for CommandBindings? does it make sense to do it in the treeview app that I am talking about? I am a bit overwhelmed because of so many options available to implement this.

Does anyone have links, sample code that does this sort of thing? A reference implementation may be?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-10T22:04:51+00:00Added an answer on May 10, 2026 at 10:04 pm

    I’m with you. I started with

    (ui) <-> (xml)

    where xml represented as LINQy XElements so I got PropertyChange notification.

    I then added some stateless helper classes to help me deal with xml (expose properties, validate data, etc). I’d bundle up XElements in ObservableCollections so I could bind to them.

    Read about M-V-VM, and decided to convert my helper classes into ViewModels. Problems: Helper classes live in the data model namespace which knows nothing about UI. Helper classes know how to convert database row into XElement, ViewModel should never see that. Helper classes deal with xml. ViewModel shouldn’t know or care.

    So I’m actually considering implementing

    (ui) <-> (viewmodel) <-> (helper) <-> (xml)

    but i just balk at raising PropChange events in helper only to reraise them in viewmodel.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 57k
  • Answers 57k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Yes, it's perfectly acceptable. Keep in mind, the contents of… May 11, 2026 at 8:30 am
  • added an answer I would probably just go with this: for (int i=0;… May 11, 2026 at 8:30 am
  • added an answer Here is one way of doing it: Creating and Using… May 11, 2026 at 8:30 am

Top Members

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.

      Related Questions

      No related questions found