This project is read-only.

SelectedVertex

May 9, 2012 at 5:09 PM

hi all, is there a way to add SelectedVertex Dependency Property to Graph control?

 

thanks

Mar 22, 2013 at 9:09 PM
Did anyone accomplish this? This could be very useful.
Apr 17, 2013 at 10:49 AM
Something like this:

Add property to GraphCanvas
        #region DP - SelectedVertex
        public static readonly DependencyProperty SelectedVertexProperty = DependencyProperty.Register("SelectedVertex", typeof(VertexControl),
                                                typeof(GraphCanvas), new PropertyMetadata(null));
        public VertexControlSelectedVertex
        {
            get { return (VertexControl)GetValue(SelectedVertexProperty); }
            set { SetValue(SelectedVertexProperty, value); }
        }
        #endregion
In VertexControl.cs add MouseDown event handler
        public VertexControl()
        {
            MouseDown += VertexControl_MouseDown;
        }
        void VertexControl_MouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            if (RootCanvas != null)
                RootCanvas.SelectedVertex = this;
            e.Handled = true; // if you don't want zoomcontrol scrolling while vertex selection
        }