Mega Code Archive

 
Categories / C# / WPF
 

Figures in a FlowDocument

<Window x:Class="Documents.Figures"     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"     Title="FloatersAndFigures" Height="478" Width="740">   <Window.Resources>     <Style x:Key="myStyle">       <Setter Property="Paragraph.FontSize" Value="30" ></Setter>       <Setter Property="Paragraph.FontStyle" Value="Italic" ></Setter>       <Setter Property="Paragraph.Foreground" Value="Green" ></Setter>       <Setter Property="Paragraph.Padding" Value="5"></Setter>       <Setter Property="Paragraph.Margin" Value="5,10,15,10"></Setter>     </Style>   </Window.Resources>   <FlowDocumentScrollViewer Name="docViewer" MinZoom="1" MaxZoom="1000" IsToolBarVisible ="True">     <FlowDocument IsOptimalParagraphEnabled="True" IsHyphenationEnabled="True" >       <Paragraph>         text         <Figure Width="100" Padding="5,0,5,0" HorizontalAnchor="PageRight">           <BlockUIContainer>             <Image Source="c:\image.jpg" ></Image>           </BlockUIContainer>         </Figure>         text       </Paragraph>       <Paragraph>         The hallway smelt of boiled cabbage and old rag mats.<Run xml:space="preserve"> </Run>         <Floater Style="{StaticResource myStyle}" Width="205" HorizontalAlignment="Left">           <Paragraph>this is a test</Paragraph>         </Floater>         text       </Paragraph>     </FlowDocument>   </FlowDocumentScrollViewer> </Window>