Copy plot to clipboard with context menu

Oystein Bjorke 10 ár síðan 0
This discussion was imported from CodePlex

Gimly wrote at 2013-10-02 14:17:

I know that it's possible to copy a plot through the ctrl-c keyboard combination, but I'd like to make it a bit more obvious by setting a Context menu that has "Copy to clipboard".

I've seen in another thread that the Plot was bound to ApplicationCommands.Copy, so I thought that this would work:
<oxy:Plot>
                <oxy:Plot.ContextMenu>
                    <ContextMenu>
                        <MenuItem Command="ApplicationCommands.Copy" Header="Copy to clipboard" />
                    </ContextMenu>
                </oxy:Plot.ContextMenu>
</oxy:Plot>
But it doesn't work, when I right-click, the context menu is displayed correctly but the "Copy to clipboard" is disabled.

Any idea?

everytimer wrote at 2013-10-02 16:19:

See https://oxyplot.codeplex.com/discussions/455532
I don't know why but Commands do not work in the ContextMenu. If you want that you should use the click event and then send a message (with Messenger or Mediator) to your ViewModel (or copy the plot in the codebehind with the click event). Good luck.