Hi,
Can you help me to create a data template with textblock (or other kind of control) where I can edit text after double click on it, drag it over the diagram, resize it and allow the “Enter” key to break a line while editing?
Here is the closest template that I came up to:
Yes, if you want the user to resize the whole node, you need to set go.NodePanel.Sizing="Fixed", not “Auto”. And remove the Width on the TextBlock, to allow it to change its width.
Or else if you want the user to resize the text itself, then you can leave NodePanel.Sizing as “Auto” but set Part.ResizeElementName to refer to the TextBlock, which you’ll need to x:Name.
Thanks,
How can I achieve that “Enter” key breaks a line?
Another issue is when I copy an external text (from notepad for example) to the node, only the first line is copied.
You can determine the appearance and behavior of the TextBox used as the text editor by specifying the go:Part.TextEditAdornmentTemplate on your TextBlock. You can start with the default text editor template defined in Themes/Generic.xaml.