Implementing Cut/Copy/Paste/arrange/etc.

Jun 11, 2013 at 5:58 PM
Markus,

There are a number of standard menu (and keyboard shortcuts) that are supposed to be common to all applications - especially the standard edit (cut, copy, paste, paste special, delete)and window options (arrange, pick from list of active forms, etc.)

In winforms, this was fairly easy. And I am sure I can find the standard WPF approach to implementing these. But I wanted to see if there was anything in the FW that I may want to know about before going off on this tangent.

And, even if it is essentially the same as I would use for a standard WPF project, it would be nice to see 1 example of a menu call for one of the edit commands (say copy) so that I could be sure I have the syntax correct for creating the ViewAction.

Thanks,

Fletcher
Coordinator
Jun 14, 2013 at 1:16 PM
WPF exposes standard application commands (check out the ApplicationCommands class) which implement all that functionality. That should do the trick.


Markus
Jun 28, 2013 at 8:51 PM
Markus,

Ok, another stupid question.

I know about the ApplicationCommands, what I can't quite figure out is how to implement them. Normally, I would create a menuItem and then attach the appropriate ApplicationCommand to that menuItem.

How do I attach it to a ViewAction? I tried creating the ViewAction before adding it to the actions, but the ViewActions don't support commands (at least not that I can figure out.)


Thanks,

Fletcher
Coordinator
Jul 1, 2013 at 9:40 PM
Well, you'd kind of have to create a wrapper view action, or subclass the default command or something. To be honest, it's been a while since I created my own edit menu, since the hotkeys always work :-). This would probably be a case where having standard view actions for people might be nice, hm? I added that to the list.


Markus