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

SelectedItem Binding

1 Answer 26 Views
Diagram
This is a migrated thread and some comments may be shown as answers.
Barış
Top achievements
Rank 1
Barış asked on 29 Sep 2015, 08:19 AM

hello, 

I try to bind to some properties of the diagram, bu  SelectedItem does not trigger. This is how i bind in constructur of my Custom class

public class CLOCDiagram : Control, IDisposable
{  
        public CLOCDiagram()
        {
            this.DefaultStyleKey = typeof(CLOCDiagram);
 
            Binding sourceBinding = new Binding("Source");
            sourceBinding.Source = this;
            sourceBinding.Mode = BindingMode.TwoWay;
            this.Diagram.SetBinding(RadDiagram.GraphSourceProperty, sourceBinding);
 
            Binding selectedItemBinding = new Binding("SelectedItem");
            selectedItemBinding.Source = this;
            selectedItemBinding.Mode = BindingMode.TwoWay;
            selectedItemBinding.Converter = new ItemToNodeConverter() { Diagram = this.Diagram };
            this.Diagram.SetBinding(RadDiagram.SelectedItemProperty, selectedItemBinding);
        }

     

 And this is my dependency property. 

    public object SelectedItem
    {
        get { return (object)this.GetValue(SelectedItemProperty); }
 
        set { this.SetValue(SelectedItemProperty, value); }
    }
 
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register("SelectedItem", typeof(object), typeof(CLOCDiagram), null);

However, graphsourceproperty works great but, SelectedItem Binding does not hit when I select a node or link in the diagram. 

 What I try to do, is replacing a node with other one. So I need to get selected node only. 

Any suggestion please?

Regards

1 Answer, 1 is accepted

Sort by
0
Barış
Top achievements
Rank 1
answered on 29 Sep 2015, 12:20 PM

I found out that the problem is about type conversion. Do not take it into account. 

 Thank you anyway. 

Regards.

Tags
Diagram
Asked by
Barış
Top achievements
Rank 1
Answers by
Barış
Top achievements
Rank 1
Share this question
or