SamplePage.xaml の相互作用ロジック
Inheritance: UserControl
Ejemplo n.º 1
0
        public void SelfUpdateDocument(SampleOption option)
        {
            var page = CreatePage();
            var size = page.PrintableSize;

            var viewbox = new Viewbox
            {
                Width   = size.Width,
                Height  = size.Height,
                Stretch = System.Windows.Media.Stretch.Uniform, // 縦横比を維持してサイズの最終調整
            };
            var v  = new SamplePage();
            var vm = option;

            viewbox.Child = v;
            v.DataContext = vm;

            viewbox.Arrange(new Rect(new Point(0, 0), size));
            viewbox.Measure(size);
            viewbox.UpdateLayout();

            page.FinalizePage(viewbox);

            // ドキュメントの作成
            var fixedDocument = new FixedDocument();

            fixedDocument.Pages.Add(page.PageContent);

            Document = fixedDocument;
        }
Ejemplo n.º 2
0
        public void UpdateDocument(SampleOption option)
        {
            List <FrameworkElement> vCollection = new List <FrameworkElement>();

            for (var i = 0; i < option.Pages; i++)
            {
                var v  = new SamplePage();
                var vm = option;

                v.DataContext = vm;
                vCollection.Add(v);
            }

            UpdateTemplateDocuments(vCollection, Stretch.Uniform);
        }