XAML Figure

This article shows how to create a Figure used in WPF FlowDocument using XAML.
  • 2454

 A figure is a portion of flow content with placement properties that can be customized independently from the primary content flow within a FlowDocument. A figure has following attributes.

·     A figure can be positioned independently of other flow contents.
 
 A figure does not support paging or wrapping to fit the contents in the given viewer. If a figure does not fit in a viewer, the portion of figure     that falls outside of the viewer will be lost.
 
  A figure can be positioned vertically and horizontally.
 
  You can set a figure height and width to fit in multiple pages, columns, or rows.

      Figure element in XAML is used to create figures to a FlowDocument. The following code snippet creates a Paragraph.

 <Figure> Blocks </ Figure >

Similar to other XAML elements, a Figure has most of the common properties such as Name, Font related properties, Foreground and Background. The following code snippet sets a few properties of a Figure.

<Figure Width="200" Height="50" Background="GhostWhite"
HorizontalAnchor="PageLeft"
HorizontalOffset="100" VerticalOffset="20" >
</Figure>

Following code listing 1 is a complete example that shows how to use some a Figure element in XAML to create a figure in a FlowDocument.

<FlowDocument ColumnWidth="400" IsOptimalParagraphEnabled="True" IsHyphenationEnabled="True"   >

    <Section Name="Heading" FontSize="20" FontFamily="Georgia" Background="LightSalmon"  >

        <Paragraph>

            Figure Sample

        </Paragraph>

    </Section>

    <Paragraph>

      

    <Figure

    Width="200" Height="50" Background="GhostWhite"

    HorizontalAnchor="PageLeft"

    HorizontalOffset="100" VerticalOffset="20" >

    <Paragraph FontStyle="Italic" TextAlignment="Left"

        Background="Beige" Foreground="DarkGreen" >

           Mindcracker Network was founded in 1999 as a community where developers

            can learn and share their knowledge and ideas with other developers.

        </Paragraph>

    </Figure>

 

    </Paragraph>

</FlowDocument>

 

Ask Your Question 
 
Got a programming related question? You may want to post your question here
 

 

© 2019 DotNetHeaven. All rights reserved.