public void CopyPlainTextToWindowsClipboard(TextControlCopyingToClipboardEventArgs args) { if (args != null) { args.Handled = true; } DataPackage dataPackage = new DataPackage { RequestedOperation = DataPackageOperation.Copy }; dataPackage.SetText(Document.Selection.Text); Clipboard.SetContent(dataPackage); }
void ITextControlCopyingToClipboardEventArgsResolver.Handled(TextControlCopyingToClipboardEventArgs e, bool handled) => e.Handled = handled;
bool ITextControlCopyingToClipboardEventArgsResolver.Handled(TextControlCopyingToClipboardEventArgs e) => e.Handled;
/// <summary> /// Sets a value that marks the routed event as handled. /// A <c>true</c> value for Handled prevents most handlers along the event route from handling the same event again. /// </summary> /// <param name="e">The requested <see cref="TextControlCopyingToClipboardEventArgs"/>.</param> /// <param name="handled"> /// <c>true</c> to mark the routed event handled. /// <c>false</c> to leave the routed event unhandled, which causes the default copy action to be performed. /// The default is <c>false</c>. /// </param> public static void Handled(this TextControlCopyingToClipboardEventArgs e, bool handled) => Resolver.Handled(e, handled);
/// <summary> /// Gets a value that marks the routed event as handled. /// A <c>true</c> value for Handled prevents most handlers along the event route from handling the same event again. /// </summary> /// <param name="e">The requested <see cref="TextControlCopyingToClipboardEventArgs"/>.</param> /// <returns> /// <c>true</c> to mark the routed event handled. /// <c>false</c> to leave the routed event unhandled, which causes the default copy action to be performed. /// The default is <c>false</c>. /// </returns> public static bool Handled(this TextControlCopyingToClipboardEventArgs e) => Resolver.Handled(e);