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

  • SEARCH
  • Home
  • 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 9153245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:14:30+00:00 2026-06-17T12:14:30+00:00

I have a model private XmlDataProvider _xmlProvider; public XmlDataProvider XmlProvider { get { return

  • 0

I have a model

private XmlDataProvider _xmlProvider;
public XmlDataProvider XmlProvider
{
        get { return _xmlProvider; }
        set { _xmlProvider = value; OnPropertyChanged("XmlProvider"); }
}

in the model constructor i read an xml file

var doc = new System.Xml.XmlDocument();
doc.Load("books.xml");

 XmlProvider = new XmlDataProvider()
 {
   Document = doc,
   XPath = @"/root"
 };

the xml file only has a root and 1 Element

<proba author="probaauthor"/>

in the viewmodel i have a reference to model

private Model _model;
public Model Model
{
        get { return _model; }
        set
        {
            _model = value;
            OnPropertyChanged("Model");
        }
}

in the view:

xmlns:localMvvmxml="clr-namespace:MvvmSamples.Mvvm.SimpleXml"

<Grid.Resources>
        <localMvvmxml:ViewModel x:Key="MyXmlProvider"/>

and below I have a stackpanel with a textbox

<StackPanel Orientation="Horizontal" DataContext="{StaticResource MyXmlProvider}" Margin="5">
            <TextBox  Text="{Binding XPath=/root/proba/@author}" Width="113"></TextBox>

of course its not working, because i could not reach the provider.
So What to write in the TextBox Binding?

thx.
charlie

  • 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. Editorial Team
    Editorial Team
    2026-06-17T12:14:32+00:00Added an answer on June 17, 2026 at 12:14 pm

    I am guessing your View is not bound to your Viewmodel possibly. I am guessing when you are performing the {Binding XPath=(location)} It is not knowing that your view is using a Viewmodel for it’s binding.

    This may help a little bit keeping in mind the namespace declarations for your code may be different.

    <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                        xmlns:vm="clr-namespace:MvvmSamples.Mvvm.ViewModels" 
                        xmlns:vw="clr-namespace:MvvmSamples.Mvvm.View">
    
    <DataTemplate DataType="{x:Type vm:SimpleXMLViewModel}">
            <vw:SimpleXML />
        </DataTemplate>
    

    Also keep in mind a good example here for MVVM: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

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

Sidebar

Related Questions

I have model: [Validator(typeof(RegisterValidator))] public class RegisterModel { public string Name { get; set;
I have the following in my model: public sealed class OAuthProvider { private readonly
I have my Model as: namespace Forecast.MVVM.WPF.ViewModel { public class ApplicationInfoViewModel { private string
so lets say I have some model class: public class MyRequestParams { private Long
Suppose I have 2 models Public class Bus extends Model{ @OneToMany(mappedBy=bus) private List<Passenger> passengers;
I have this class public class Model { private String a; private String b;
Say I have these two models: public class City extends Model { @ManyToOne private
I have a Model that looks like public class Patient { private ICollection<Refill> _refills
I have a model with complex properties like: public partial class CrmDefinedEntity { private
I have a model like this defined... public class Product{ private long timestamp; //

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.