This is a migrated thread and some comments may be shown as answers.

Notification when print is cancelled

1 Answer 15 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
kilhoffer
Top achievements
Rank 1
kilhoffer asked on 21 Nov 2013, 07:22 PM
There exists an event on the editor called PrintCompleted, that I can use to know when my print operation has completed. I need this notification so my viewmodel can navigate away from the document that was edited. So far so good. The problem lies when the user hits the print dialog's "cancel" button. I need to be able to know if that happens because there are still things I need to do. Since there is no "PrintCancelled" event, how will I ever know the user cancelled that operation from the system print dialog? Is there even a way?

Thanks in advance!

1 Answer, 1 is accepted

Sort by
0
Petya
Telerik team
answered on 26 Nov 2013, 02:03 PM
Hi,

Thank you for contacting us!

RadRichTextBox's printing functionality uses the default PrintDialog and its ShowDialog() method. As the method returns false when Cancel is clicked, you can handle the desired case like this:
PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() == true)
{
    this.radRichTextBox.Print(dialog, new PrintSettings());
}
else
{
    MessageBox.Show("Printing canceled!");
}

Let us know if you have other questions.

Regards,
Petya
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
RichTextBox
Asked by
kilhoffer
Top achievements
Rank 1
Answers by
Petya
Telerik team
Share this question
or