This question is locked. New answers and comments are not allowed.
Hi,
I am getting an error when I try to print a RichTextBox in native mode. The Error is "Dialogs must be user initiated. If I Use Mode=Html then it works but the document prints incorrectly. When I export to PDF it works and prints correctly. See code in viewmodel below, I have also tried the dispatcher associated with the RichTextBox. The RichTextBox is close to the root of the visual tree, but has a height of 0px. It Throws the exception on line "rtb.Print( package.Name, Telerik.Windows.Documents.UI.PrintMode.Native ); ". I have also tried to execute the "CreateDocument". Without dispatching on the UI thread explicitly
Please Help
Jaco
I am getting an error when I try to print a RichTextBox in native mode. The Error is "Dialogs must be user initiated. If I Use Mode=Html then it works but the document prints incorrectly. When I export to PDF it works and prints correctly. See code in viewmodel below, I have also tried the dispatcher associated with the RichTextBox. The RichTextBox is close to the root of the visual tree, but has a height of 0px. It Throws the exception on line "rtb.Print( package.Name, Telerik.Windows.Documents.UI.PrintMode.Native ); ". I have also tried to execute the "CreateDocument". Without dispatching on the UI thread explicitly
Please Help
Jaco
/// <
summary
>
/// Prints the specified package.
/// </
summary
>
/// <
param
name
=
"package"
>The package.</
param
>
public void Print(PMPackage package, RadRichTextBox rtb)
{
GalaSoft.MvvmLight.Threading.DispatcherHelper.UIDispatcher.BeginInvoke((Action)(() =>
{
rtb.Document = CreateDocument(package);
}));
rtb.Print(package.Name, Telerik.Windows.Documents.UI.PrintMode.Native);
}