In-place editing of labels (primary and/or secondary) in WPF control?

Mar 27, 2009 at 7:00 PM
Is in-place editing of text labels (primary and/or secondary) supported in the WPF control? If so, can someone direct me to the relevant parts of the API?

If it's not supported, has anyone implemented a good solution for this? Care to share it?
Mar 28, 2009 at 6:38 PM
Edited Apr 17, 2009 at 5:36 PM
No, that's not supported.  The labels are drawn as static text by NodeXL.Visualization.Wpf.VertexDrawer using WPF's DrawingContext.DrawText() method.

If you want to implement this yourself, one way would be as follows:

1.  Handle the NodeXLControl.VertexClick event.

2.  In the event handler, create (or show a previously hidden) a System.Windows.Controls.TextBox control, position it on top of the vertex whose label needs to be edited, and set the TextBox text to the label text.

3.  After the user edits the TextBox text and presses Enter, update the vertex metadata value that determines the label (ReservedMetadataKeys.PerVertexPrimaryLabel) and destroy (or hide) the TextBox.

This can be done in application code, in a class derived from NodeXLControl, or within your own private copy of NodeXLControl.

-- Tony