Binding not working

3 posts, 0 answers
  1. Mikel
    Mikel avatar
    21 posts
    Member since:
    Feb 2014

    Posted 20 Jan Link to this post

    Hello

     

    Im working with TreeView and I have a little problem when a property changed and the value propagation. I attached a photo for show it better.

     

    I will try explain:

     

    If I change "Status" property to a parent node, this new "Status" is propagated to its  children. For example, I change to RIB2 node "Status" to disable(Gray), all children of RIB2 will change their "Status" to disable. Or I change "Status" to R2FFA node, this change will only affect to that node becouse it is last one.

     The problem I have is propapage the "Status" of a child node to parent node. The "Status" property is calculated in all parent nodes, I mean, that property comes from "Status" of subnodes, only last children nodes, have the value of "Status".

    get
    {
        //Si tiene representable point, devuelve su valor
        if (this.Representable_Point != null)
        {
            return this.Representable_Point.Status;
        }
        //Si no, el de sus hijos
        else
        {
            return this.Get_Child_Status();
        }
    }

    Any parent node has representable point,  so always calculate "the Status". Get_Child_Status will return a enum value or null.If all children have the same "Status" it will get that status, if at least one child, has different status from the rest, that method will return null.

     

    Then, how can I propagate to parent node updateproperty when, child node property has changed?

     

    Thank you for help!

    Regards!

     

     

      

  2. Dinko
    Admin
    Dinko avatar
    204 posts

    Posted 25 Jan Link to this post

    Hi Mikel,

    To achieve your requirement you can create a Parent property where you preserve the parent for every RadTreeViewItem view model. So when you change a property of a child you can easily get its parent and propagate the changes to the parent. I have created a sample project demonstrating this approach.

    Can you give this project a try and let me know if this is the behavior you are trying to achieve in your application.

    Regards,
    Dinko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Mikel
    Mikel avatar
    21 posts
    Member since:
    Feb 2014

    Posted 26 Jan in reply to Dinko Link to this post

    Hi Dink,

     

    Thank you for help, that works! I make it little simple. I invoke that  method in the child when Status property changed

     

    public void ReRaise_Status_Update()
    {
        //Lanza el evento
        RaisePropertyChanged(Tree_Item.StatusPropertyName);
     
        //Si tiene padre
        if (this.Parent != null)
        {
            this.Parent.ReRaise_Status_Update();
        }
     
    }

Back to Top