WPF: Copy Property to Clipboard
Posted
by Phil Sandler
on Stack Overflow
See other posts from Stack Overflow
or by Phil Sandler
Published on 2010-04-01T20:00:51Z
Indexed on
2010/04/01
20:03 UTC
Read the original article
Hit count: 317
I have a string property in my ViewModel/Datacontext and want a simple button that copies its contents to the clipboard. Is this possible to do from XAML, or I do I need to handle the button click event (or use an ICommand) to accomplish this? I thought the following would work, but my button is always greyed out:
<Button Width="100" Content="Copy" Command="ApplicationCommands.Copy"
CommandTarget="{Binding MyStringProperty}"/>
© Stack Overflow or respective owner