Пример #1
0
        public void Load(IPdfSource source, string password = null)
        {
            this.virtualPanel = VisualTreeHelperEx.FindChild <CustomVirtualizingPanel>(this);
            this.scrollViewer = VisualTreeHelperEx.FindChild <ScrollViewer>(this);
            this.virtualPanel.PageRowBounds = this.parent.PageRowBounds.Select(f => f.SizeIncludingOffset).ToArray();
            this.imageProvider = new PdfImageProvider(source, this.parent.TotalPages,
                                                      new PageDisplaySettings(this.parent.GetPagesPerRow(), this.parent.ViewType, this.parent.HorizontalMargin, this.parent.Rotation),
                                                      password: password);

            if (this.parent.ZoomType == ZoomType.Fixed)
            {
                this.CreateNewItemsSource();
            }
            else if (this.parent.ZoomType == ZoomType.FitToHeight)
            {
                this.ZoomToHeight();
            }
            else if (this.parent.ZoomType == ZoomType.FitToWidth)
            {
                this.ZoomToWidth();
            }

            if (this.scrollViewer != null)
            {
                this.scrollViewer.Visibility = System.Windows.Visibility.Visible;
                this.scrollViewer.ScrollToTop();
            }
        }
Пример #2
0
        public void IsItemsHost_PlainPanel()
        {
            Panel panel = new StackPanel();

            Enqueue(() => TestPanel.Children.Add(panel));
            Enqueue(() => Assert.IsFalse(new StackPanel().IsItemsHost, "#1"));
            Enqueue(() => panel = new CustomVirtualizingPanel());
            Enqueue(() => Assert.IsFalse(new VirtualizingStackPanel().IsItemsHost, "#2"));
            EnqueueTestComplete();
        }
        public void Load(IPdfSource source, string password = null)
        {
            virtualPanel = VisualTreeHelperEx.FindChild<CustomVirtualizingPanel>(this);
            scrollViewer = VisualTreeHelperEx.FindChild<ScrollViewer>(this);
            virtualPanel.PageRowBounds = parent.PageRowBounds.Select(f => f.SizeIncludingOffset).ToArray();
            imageProvider = new PdfImageProvider(source, parent.TotalPages,
                new PageDisplaySettings(parent.GetPagesPerRow(), parent.ViewType, parent.HorizontalMargin,
                    parent.Rotation),
                password: password);

            if (parent.ZoomType == ZoomType.Fixed)
                CreateNewItemsSource();
            else if (parent.ZoomType == ZoomType.FitToHeight)
                ZoomToHeight();
            else if (parent.ZoomType == ZoomType.FitToWidth)
                ZoomToWidth();

            if (scrollViewer != null)
            {
                scrollViewer.Visibility = Visibility.Visible;
                scrollViewer.ScrollToTop();
            }
        }