/// <summary>
 /// Initializes a new instance of <see cref="Syncfusion.UI.Xaml.Grid.PrintPageControl"/> class.
 /// </summary>
 /// <param name="printManagerBase">
 /// Specifies print related operations to initialize print page control.
 /// </param>
 public PrintPageControl(PrintManagerBase printManagerBase)
 {
     this.printManagerBase = printManagerBase;
     DefaultStyleKey       = typeof(PrintPageControl);
     this.Loaded          += OnLoaded;
     this.Unloaded        += PrintPageControl_Unloaded;
 }
示例#2
0
        private void OnprintCommandClicked(object obj)
        {
#if WPF
            PrintManagerBase.PrintWithDialog();
#else
            PrintManagerBase.Print();
#endif
        }
 void OnPrintOptionsControlDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     if (!(e.NewValue is PrintPreviewAreaControl))
     {
         return;
     }
     printDataContext = e.NewValue as PrintPreviewAreaControl;
     printManager     = printDataContext.PrintManagerBase;
 }
示例#4
0
 /// <summary>
 /// Disposes all the resources used by the <see cref="Syncfusion.UI.Xaml.Grid.PrintPreviewAreaControl"/> class.
 /// </summary>
 /// <param name="isDisposing">Indicates whether the call is from Dispose method or from a finalizer.</param>
 protected virtual void Dispose(bool isDisposing)
 {
     if (isdisposed)
     {
         return;
     }
     if (isDisposing)
     {
         printManager = null;
     }
     isdisposed = true;
 }
示例#5
0
 internal void SetPrintManagerBase(PrintManagerBase printBase)
 {
     if (printBase == null)
     {
         return;
     }
     this.printBase = printBase;
     printBase.InValidatePreviewPanel = InValidate;
     printBase.InitializePrint(false);
     Child = printBase.CreatePage(1);
     Children.Add(Child);
 }
 /// <summary>
 /// Disposes all the resources used by the <see cref="Syncfusion.UI.Xaml.Grid.GridPrintPreviewControl"/> class.
 /// </summary>
 /// <param name="isDisposing">Indicates whether the call is from Dispose method or from a finalizer.</param>
 protected virtual void Dispose(bool isDisposing)
 {
     if (isdisposed)
     {
         return;
     }
     if (isDisposing)
     {
         printManager = null;
         PartPrintPreviewAreaControl = null;
     }
     isdisposed = true;
 }
 /// <summary>
 /// Disposes all the resources used by the <see cref="Syncfusion.UI.Xaml.Grid.PrintPageControl"/> class.
 /// </summary>
 /// <param name="isDisposing">Indicates whether the call is from Dispose method or from a finalizer.</param>
 protected virtual void Dispose(bool isDisposing)
 {
     if (isdisposed)
     {
         return;
     }
     if (isDisposing)
     {
         printManagerBase = null;
         this.DataContext = null;
     }
     isdisposed = true;
 }
 /// <summary>
 /// Disposes all the resources used by the <see cref="Syncfusion.UI.Xaml.Grid.PrintOptionsControl"/> class.
 /// </summary>
 /// <param name="isDisposing">Indicates whether the call is from Dispose method or from a finalizer.</param>
 protected virtual void Dispose(bool isDisposing)
 {
     if (isdisposed)
     {
         return;
     }
     if (pagesizes != null || pageThickness != null)
     {
         pagesizes.Clear();
         pageThickness.Clear();
     }
     if (isDisposing)
     {
         printManager     = null;
         printDataContext = null;
     }
     isdisposed = true;
 }
示例#9
0
        //internal PreviewWindow(ReportSelectionViewModel _vm)
        //{
        //    try
        //    {
        //        InitializeComponent();
        //        vm = _vm;

        //    }
        //    catch (Exception)
        //    {


        //    }


        //}

        void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            printDataContext = e.NewValue as PrintPreviewAreaControl;
            printDataContext.PrintOrientation = PrintOrientation.Landscape;
            try
            {
                //using (SqlConnection conn = new SqlConnection(GlobalClass.DataConnectionString))
                //{
                //    dynamic PrintProps = conn.Query("SELECT * FROM REPORTMASTER WHERE REPORTNAME = '" + vm.ReportName + "'").First();

                //    printDataContext.PrintPageHeaderHeight = (double)PrintProps.PRINT_PAGEHEADERHEIGHT * cmConst;
                //    printDataContext.PrintPageFooterHeight = (double)PrintProps.PRINT_PAGEFOOTERHEIGHT * cmConst;
                //    printDataContext.PrintPageWidth = (double)PrintProps.PRINT_PAGEWIDTH * cmConst;
                //    printDataContext.PrintPageHeight = (double)PrintProps.PRINT_PAGEHEIGHT * cmConst;
                //    printDataContext.PrintOrientation = (PrintOrientation)PrintProps.PRINT_ORIENTATION;
                //    printDataContext.PrintPageMargin = new Thickness((double)PrintProps.PRINT_MARGINLEFT * cmConst, (double)PrintProps.PRINT_MARGINTOP * cmConst, (double)PrintProps.PRINT_MARGINRIGHT * cmConst, (double)PrintProps.PRINT_MARGINBOTTOM * cmConst);

                //    ResourceDictionary Resource = GlobalClass.GetFrameworkElement<ResourceDictionary>(GetHeaderFooterDataTemplateString(PrintProps.PRINT_PAGERESOURCE));

                //    printDataContext.PrintPageHeaderTemplate = Resource["HeaderTemplate"] as DataTemplate;
                //    //GlobalClass.FindVisualChild<FrameworkElement>(printDataContext, "HeaderPanel").DataContext = vm;
                //    //(printDataContext.FindName("HeaderPanel") as FrameworkElement).DataContext = vm;
                //    //((FrameworkElement)printDataContext.PrintPageHeaderTemplate.FindName("HeaderPanel",).DataContext = vm;
                //    printDataContext.PrintPageFooterTemplate = Resource["FooterTemplate"] as DataTemplate;
                //    //printDataContext.DataContext = vm;

                //    //FrameworkElementFactory


                //}
            }
            catch (Exception)
            {
            }



            printDataContext.PrintManagerBase.PrintPageFooterHeight   = printDataContext.PrintPageFooterHeight;
            printDataContext.PrintManagerBase.PrintPageFooterTemplate = printDataContext.PrintPageFooterTemplate;
            printDataContext.PrintManagerBase.PrintPageHeaderHeight   = printDataContext.PrintPageHeaderHeight;
            printDataContext.PrintManagerBase.PrintPageHeaderTemplate = printDataContext.PrintPageHeaderTemplate;
            printManager = printDataContext.PrintManagerBase;
        }
示例#10
0
        private void OnPartComboPapersSelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            if (printDataContext == null)
            {
                return;
            }
            printManager = printDataContext.PrintManagerBase;

            double width  = 0;
            double height = 0;

            switch ((e.AddedItems[0] as ComboBoxItem).Content.ToString())
            {
            case "Letter":
                width  = 29.59;
                height = 27.94;
                break;

            case "Legal":
                width  = 29.59;
                height = 35.56;
                break;

            case "Executive":
                width  = 18.41;
                height = 26.67;
                break;

            case "A4":
                width  = 21;
                height = 29.7;
                break;

            case "Envelope #10":
                width  = 10.48;
                height = 24.13;
                break;

            case "Envelope DL":
                width  = 11;
                height = 22;
                break;

            case "Envelope C5":
                width  = 16.2;
                height = 22.9;
                break;

            case "Envelope B5":
                width  = 17.6;
                height = 25;
                break;

            case "Envelope Monarch":
                width  = 9.84;
                height = 19.05;
                break;

            case "Custom Size":
                OnPageSizeOkButtonClick(null, null);
                if (PageHeightUpDown != null && PageHeightUpDown.Value != null)
                {
                    height = (double)PageHeightUpDown.Value;
                }
                if (PageWidthUpDown != null && PageWidthUpDown.Value != null)
                {
                    width = (double)PageWidthUpDown.Value;
                }
                break;
            }
            if (PageHeightUpDown != null && PageHeightUpDown.Value != null)
            {
                PageHeightUpDown.Value = height;
            }
            if (PageWidthUpDown != null && PageWidthUpDown.Value != null)
            {
                PageWidthUpDown.Value = width;
            }
            height *= cmConst;
            width  *= cmConst;

            printManager.PrintPageWidth  = width;
            printManager.PrintPageHeight = height;
        }
示例#11
0
 void OnDataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
 {
     printDataContext = e.NewValue as PrintPreviewAreaControl;
     printManager     = printDataContext.PrintManagerBase;
 }
示例#12
0
 private void OnQuickprintCommandClicked(object obj)
 {
     PrintManagerBase.Print();
 }
 internal GridPrintPreviewControl(SfDataGrid dataGrid, PrintManagerBase printManager)
 {
     DefaultStyleKey   = typeof(GridPrintPreviewControl);
     this.printManager = printManager ?? new GridPrintManager(dataGrid);
     Loaded           += OnGridPrintPreviewControlLoaded;
 }
示例#14
0
 /// <summary>
 /// Initializes a new instance of <see cref="Syncfusion.UI.Xaml.Grid.PrintPreviewPanel"/> class.
 /// </summary>
 /// <param name="printBase">
 /// An instance of the <see cref="Syncfusion.UI.Xaml.Grid.PrintManagerBase"/>.
 /// </param>
 public PrintPreviewPanel(PrintManagerBase printBase)
 {
     SetPrintManagerBase(printBase);
 }