Notification when print is cancelled

2 posts, 0 answers
  1. kilhoffer
    kilhoffer avatar
    40 posts
    Member since:
    May 2007

    Posted 21 Nov 2013 Link to this post

    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!
  2. Petya
    Admin
    Petya avatar
    975 posts

    Posted 26 Nov 2013 Link to this post

    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 >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top