How can I add a click funtion on the nodes of the graph?

Jun 24, 2012 at 2:25 AM

Hi christian,

I downloaded the library, and it is what I wanted, thank you. 
I am not familiar with it, I want to ask you whether it can be added some additional functions on the nodes such as click funtion, clips funtion and so on.

Jul 22, 2013 at 12:53 PM
Inside the ControlTemplate you created for display'ng the nodes just include a "MouseLeftButtonUp" eventhandler.
In your codebehind handle the event, the sender object is the object clicked, this can be casted to the type needed.

example:
 private void LayoutRoot_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
                if (sender.GetType() == typeof(Grid))
                {
                    Grid MyGrid = sender as Grid;

                    if (MyGrid.DataContext.GetType() == typeof(YOUROBJECT))
                    {
                        //clicked on a Graph item node, open it!
                        YOUROBJECT MyClickedItem = MyGrid.DataContext as YOUROBJECT;

            //DO YOUR MAGIC

                    }
                }
        }