Ejemplo n.º 1
0
        private void CreateContent()
        {
            ContentPanel.Children.Clear();

            var readerPage = new ReaderPage();

            readerPage.Padding = Padding;
            readerPage.SetContent(content, LineHeight);
            ContentPanel.Children.Add(readerPage);
            readerPage.Width  = ContentBorder.ActualWidth;
            readerPage.Height = ContentBorder.ActualHeight;
            readerPage.Measure(new Windows.Foundation.Size(ContentBorder.ActualWidth, ContentBorder.ActualHeight));

            while (readerPage.HasOverflow)
            {
                var tmp = new ReaderPage();
                tmp.Padding = Padding;
                tmp.SetContent(readerPage);
                ContentPanel.Children.Add(tmp);
                tmp.Width  = ContentBorder.ActualWidth;
                tmp.Height = ContentBorder.ActualHeight;
                tmp.Measure(new Windows.Foundation.Size(ContentBorder.ActualWidth, ContentBorder.ActualHeight));
                readerPage = tmp;
            }

            Count = ContentPanel.Children.Count;
        }
Ejemplo n.º 2
0
        public void SetContent(ReaderPage readerPage)
        {
            var textBlock = new RichTextBlockOverflow();

            if (readerPage.ContentControl is RichTextBlock rtb)
            {
                rtb.OverflowContentTarget = textBlock;
            }
            else if (readerPage.ContentControl is RichTextBlockOverflow of)
            {
                of.OverflowContentTarget = textBlock;
            }

            textBlock.Margin = Padding;

            this.Content   = textBlock;
            ContentControl = textBlock;
        }