SelectedItem Binding

2 posts, 0 answers
  1. Barış
    Barış avatar
    19 posts
    Member since:
    Jul 2015

    Posted 29 Sep 2015 Link to this post


    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?


  2. Barış
    Barış avatar
    19 posts
    Member since:
    Jul 2015

    Posted 29 Sep 2015 in reply to Barış Link to this post

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

     Thank you anyway. 


  3. DevCraft R3 2016 release webinar banner
Back to Top