Exemple #1
0
        private List <ContentPresenter> GetChildElements(ContentPresenter element)
        {
            CustomCanvas elementCanvas = element.FindChild <CustomCanvas>(string.Empty);
            var          childs        = elementCanvas?.Children.Cast <ContentPresenter>().ToList();

            return(childs);
        }
Exemple #2
0
 FindChildAs <T>
     (this ContentPresenter p
     , string name
     )
     where T : class
 {
     return(p.FindChild(name) as T);
 }
Exemple #3
0
        private static void ResetVisualState(ContentPresenter objectToPrint, PrintCapabilities printCaps, bool wasVirtualized)
        {
            objectToPrint.Width = double.NaN;
            objectToPrint.UpdateLayout();
            objectToPrint.LayoutTransform = new ScaleTransform(1, 1);
            Size size = new Size(printCaps.PageImageableArea.ExtentWidth,
                                 printCaps.PageImageableArea.ExtentHeight);

            objectToPrint.Measure(size);
            objectToPrint.Arrange(new Rect(new Point(printCaps.PageImageableArea.OriginWidth,
                                                     printCaps.PageImageableArea.OriginHeight), size));

            if (!wasVirtualized)
            {
                return;
            }
            var dg = objectToPrint.FindChild <DataGrid>();

            dg.EnableRowVirtualization    = true;
            dg.EnableColumnVirtualization = true;
            VirtualizingPanel.SetIsVirtualizing(dg, true);
        }