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 7554249
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T11:17:16+00:00 2026-05-30T11:17:16+00:00

My situation is slightly different than from other posts and I was not able

  • 0

My situation is slightly different than from other posts and I was not able to solve it with the other trhreads. So that why I ask.

I have a class that is obtained from deserializing an XML like:

<?xml version="1.0" encoding="UTF-8"?>
<node>
    <leaf>
        <name>node 1</name>
        <text>text 1</text>
        <url>url 1</url>
    </leaf>
    <leaf>
        <name>node 2</name>
        <text>text 2</text>
        <url>url 2</url>
    </leaf>
</node>

so the class is:

[XmlRoot("node")]
public class csNodeList
{
    public csNodeList()
    {
        Leaf = new csLeafCollection();
    }

    [XmlElement("leaf")]
    public csLeafCollection Leaf
    {
        get;
        set;
    }
}

public class csLeaf
{
    public csLeaf()
    {
        Name ="";
        Description = "";
        Address = "";
    }

    [XmlElement("name")]
    public string Name
    {
        get;
        set;
    }

    [XmlElement("text")]
    public string Description
    {
        get;
        set;
    }

    [XmlElement("url")]
    public string Address
    {
        get;
        set;
    }
}

public class csLeafCollection : System.Collections.ObjectModel.ObservableCollection<csLeaf>
{
}

Then I have 2 Views, one to show all the leafs and one to edit one leaf. I’ve implemented commit and rollback so I use messaging back and forth to pass the new values and I store the old ones.

To do so I copy the objects a a backup variable and then I modify the ones associated via binding to the XAML view, in this way (in theory) any change to the ViewModel data should be reflected.
Also is better because if I commit the changes I just discard the backup variables (this is 90% of the times) and if I need to roll back I copy back from the backup variables.

MainView:

public const string listPropertyName = "list";
private csNodeList _list = new csNodeList();
public csNodeList list
{
    get
        {
        return _list;
    }
    set
    {
        Set(listPropertyName, ref _list, value, false);
    }
}

Using the message I send back the new values of a node and I put them in the correct position:

private void DoSomething(csMessage message)
{
    csMessage rmessage;
    if (message != null)
    {
        switch (message.destination)
        {
            case csMessage.e2MessageDest.updateNode:
            //_editP should be fine.
            list.Leaf[list.Leaf.IndexOf(_editP)].Name = ((csLeaf)message.payload).Name;
            list.Leaf[list.Leaf.IndexOf(_editP)].Text= ((csLeaf)message.payload).Text;
            list.Leaf[list.Leaf.IndexOf(_editP)].Address = ((csLeaf)message.payload).Address;
            RaisePropertyChanged(listPropertyName , null, _list, true);
            break;
        }
    }
}

The code is executed correctly and the item is changed.

BUT the RaisePropertyChanged is ignored. I’ve tried even just the one with the listPropertyName without any change.

If I save the changes exit from the app and get back I see the new value correctly stored

Can you please help me?

Thanks,
Massimo

  • 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-05-30T11:17:17+00:00Added an answer on May 30, 2026 at 11:17 am

    Thank you everyone for the help.
    Investigating your suggestion I’ve found a slightly different solution; as you correctly said the issue is that the leaf fields are not “observable” so they do not generate a notification event.

    I’ve noticed that if I add or Delete a profile the binding is updated.

    So what I’ve decided to do is not to edit directly the leafs but to replace the node.
    What I do not like is that I have to create a node to replace the old one and this allocates a little bit more memory… but for small data like the one I have it can work without any major impact on the app performance/memory foot print.

    Here is what I do:

            csLeaf _leaf = new slLeaf();
            _leaf.Name = ((csLeaf)message.payload).Name; 
            _leaf.Text= ((csLeaf)message.payload).Text; 
            _leaf.URL = ((csLeaf)message.payload).Address; 
            list.Leaf[list.Leaf.IndexOf(_editP)] = _leaf;
    

    To optimized readabilty of code I’ve enhanced it adding a constructor with 3 parameters so that the code can be:

            csLeaf _leaf = new slLeaf(((csLeaf)message.payload).Name, ((csLeaf)message.payload).Text, ((csLeaf)message.payload).Address);
            list.Leaf[list.Leaf.IndexOf(_editP)] = _leaf;
    

    The constructor is:

    public csLeaf(string _name, string _description, string _address) 
    { 
        Name = _name; 
        Description = _description;
        Address = _address; 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I slightly remember from age old PHP days (years ago) that different functions wanted
Question slightly in the abstract... We have a situation where we have a struct
Situation: I have a simple XML document that contains image information. I need to
I looked through previous questions to this effect, but my situation is slightly different...
I have two types of custom handhelds which are similar, but slightly different, each
I have seen other posts on this site with answers, but I think I
a noob question here. I have a very strange situation that's very puzzling to
I have come across a situation I have not encountered before using the IF
I am looking for help; Situation is that I have 2 databases which should
I know other posts have been made regarding this, but so far the answers

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.