Nick Cooper

Nick Cooper

  • NA
  • 1
  • 0

Can't enabled 'selected' control in System.Windows.Controls.PrintDialog

Jun 7 2010 9:05 AM

I've been trying to use System.Windows.Controls.PrintDialog to print items in a data grid. Printing all items in the grid works fine. The problem comes when I want to print selected items only - I can't get the PrintDialog to enable the 'Selected' radio button.
Code is as follows:
PrintDialog printDialog = new PrintDialog();
printDialog.PageRangeSelection =
PageRangeSelection.AllPages;
printDialog.UserPageRangeEnabled =
true;

if ((bool)printDialog.ShowDialog().GetValueOrDefault())
{
   etc....
When the print dialog appears, in the Page Range section, 'All' and 'Pages' are enabled, but not 'Selection' (or 'Current Page', for that matter).
There doesn't appear to be anything obvious among the properties/methods for PrintDialog that will help me here.
Note that this only seems to be a problem with System.Windows.Controls.PrintDialog (not System.Windows.Forms.PrintDialog)
Has anyone else come across this one?
Cheers
Nick