A floater is
a portion of flow content with placement properties that can be customized
independently from the primary content flow within a FlowDocument. A floater
has following attributes.
·
A floater cannot be positioned.
·
You cannot set the offset or anchor on a
floater.
·
A floater cannot be sized to more than one
column. If the size of a floater does not fit in a column, the outside area
will not be visible.
·
You cannot set height of a floater.
·
If contents of a floater do not fit in a given width,
it paginates. It may paginate to next column, next page and so on.
Floater element in XAML is used to create floater to a
FlowDocument. The following code snippet creates a floater.
<Floater> Blocks
</ Floater >
A Floater has only two properties – HorizontalAlignment and
Width. The following code snippet sets these properties.
<Floater Name="MCFloater" Background="GhostWhite" ]
Width="300" HorizontalAlignment="Left"
>
</ Floater >
Listing 1 is a complete example that shows how to create a
Floater and add some contents to it.
<FlowDocument ColumnWidth="400" IsOptimalParagraphEnabled="True" IsHyphenationEnabled="True"
>
<Section Name="Heading" FontSize="20" FontFamily="Georgia" Background="LightSalmon" >
<Paragraph>
Floater Sample
</Paragraph>
</Section>
<Paragraph>
<Floater Name="MCFloater" Background="GhostWhite"
Width="300" HorizontalAlignment="Left"
>
<Table CellSpacing="5">
<Table.Columns>
<TableColumn Width="155"/>
<TableColumn Width="130"/>
</Table.Columns>
<TableRowGroup>
<TableRow>
<TableCell ColumnSpan="3" Background="LightBlue" FontSize="16" >
<Paragraph>Mindcracker Statistics</Paragraph>
</TableCell>
</TableRow>
<TableRow Background="LightGoldenrodYellow" FontSize="11">
<TableCell>
<Paragraph FontWeight="Bold">Monthly Page views:</Paragraph>
</TableCell>
<TableCell>
<Paragraph>3.8 Million</Paragraph>
</TableCell>
</TableRow>
<TableRow FontSize="11" Background="LightGray">
<TableCell>
<Paragraph FontWeight="Bold">Monthly Unique Visitors:</Paragraph>
</TableCell>
<TableCell>
<Paragraph>2.3 Million</Paragraph>
</TableCell>
</TableRow>
<TableRow Background="LightGoldenrodYellow" FontSize="11">
<TableCell>
<Paragraph FontWeight="Bold">US Visitors:</Paragraph>
</TableCell>
<TableCell>
<Paragraph>43%</Paragraph>
</TableCell>
</TableRow>
<TableRow>
<TableCell ColumnSpan="4">
<Paragraph FontSize="10" FontStyle="Italic">
View more
details on
<Hyperlink NavigateUri="http://www.c-sharpcorner.com/forums/">
Mindcracker
Network.
</Hyperlink>
</Paragraph>
</TableCell>
</TableRow>
</TableRowGroup>
</Table>
</Floater>
</Paragraph>
</FlowDocument>
Listing 1