This is a migrated thread and some comments may be shown as answers.

Binding not working

2 Answers 22 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Mikel
Top achievements
Rank 1
Mikel asked on 20 Jan 2016, 12:15 PM

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 Answers, 1 is accepted

Sort by
0
Dinko
Telerik team
answered on 25 Jan 2016, 11:41 AM
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
0
Mikel
Top achievements
Rank 1
answered on 26 Jan 2016, 11:30 AM

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();
    }
 
}

Tags
TreeView
Asked by
Mikel
Top achievements
Rank 1
Answers by
Dinko
Telerik team
Mikel
Top achievements
Rank 1
Share this question
or