As most MessageBoxes, the WPF MessageBox copies all of its contents (caption, text, buttons) to the clipboard if the user presses CTRL+C while the MessageBox is shown. So far everything is fine.
Now I would like to supply additional information, but only to the clipboard, not in the MessageBox itself. Does anyone know how I would do this?
System.Windows.MessageBox.Show(this, "The Message", "MsgBox Caption", MessageBoxButton.OK, MessageBoxImage.Information);
Sure! Just add whatever text you want to be copied to the message box!
There’s no good reason for wanting to do this any other way. And even if there were, it’s not possible. This is not something implemented in WPF; the Win32
MessageBoxAPI does it internally. There’s no button or switch to configure how it works.Others have suggested creating your own message box form and trying to simulate this behavior, but I would very much advise against that. It’s very difficult to get right all of the little things that the
MessageBoxAPI is actually doing for you behind the scenes.The better solution is to upgrade to the
TaskDialogAPI and add a “More Info” button to the dialog that drops down a panel displaying additional information about the message. Users are already familiar with this style of dialog, as it’s used internally throughout current versions of the operating system. The less you deviate from your platform’s conventions, the happier your users will be.