Exemple #1
0
        /// <summary>
        /// Kopiert ein FlowDocument und passt die
        /// </summary>
        /// <param name="from"></param>
        /// <param name="thickness"></param>
        /// <returns></returns>
        public static FlowDocument CopyWithTickness(this FlowDocument from, Thickness thickness)
        {
            var flowDocument = from.CopyDocument();

            if (flowDocument == null)
            {
                return(null);
            }

            foreach (var block in flowDocument.Blocks.OfType <Paragraph>())
            {
                block.Margin = new Thickness(thickness.Left, thickness.Top, thickness.Right, thickness.Bottom);
            }

            foreach (var block in flowDocument.Blocks.OfType <List>())
            {
                block.Margin = new Thickness(thickness.Left, thickness.Top, thickness.Right, thickness.Bottom);
            }
            return(flowDocument);
        }