09-12-2017 08:43 AM
Hi all,
I would like to have the legend(s) of my graph(s) movable in a WPF project, in form of clicking and dragging it around on top of the graph control. From this topic, there is an example for WinForms, which does not work with WPF. What would be the 'best practice' to implement this? In my project, I have a several graph controls and their according legends placed together in one grid cell. I found some topics of dragging UIElements with the help of the Thumb class, but this works only with Canvas and I could not get any good solution with that. I would appreciate any help.
Thanks
09-14-2017 10:29 AM
Yes, in Windows Forms everything implicitly used canvas layout, whereas WPF gives you more granular control over content layout. To support dragging in a panel-independent fashion, you could use the Thumb example and set WPF properties like Margin (rather than Canvas.Left/Canvas.Top), or set a TranslateTransform, to re-position the graph legend.