Flow Documents in WPF using VB.NET

In this article you will learn about the Flow Documents in WPF.
  • 3093
 

Windows Presentation Framework (WPF) giving another option, "to the developers to display content" that is Flow Documents. Flow Documents are aimed at screen reading and provide a more dynamic and arguably more sophisticated model. Flow Documents work for almost everything related to text content, from product descriptions to entire books.

WPF is a massive step forward for Windows client development, and delivers a super-rich .NET UI framework that integrates vector graphics, rich flow text support, and 3D visualization with a powerful control model framework.

Flow document content, as I mentioned before, is a new feature of WPF. In its simplest form, the following code creates a flow document.

Example of an Flow Document

<Window x:Class="WpfFlowDocuments.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="A Flow Document" Height="300" Width="500">
  
<Window.Resources>
       
<Style x:Key="CodeListing">
           
<Setter Property="Paragraph.Background" Value="LightGray"/>
       
</Style>
       
<Style x:Key="FloatingContent">
           
<Setter Property="Paragraph.Foreground" Value="Navy" />
           
<Setter Property="Paragraph.Background" Value="Gray" />
       
</Style>
       
<Style TargetType="{x:Type TableCell}">
           
<Setter Property="Padding" Value="5"/>
       
</Style>
  
</Window.Resources>
   
<FlowDocumentReader>
       
<FlowDocument>
           
<Section FontSize="14pt">
               
<Paragraph TextAlignment="Left" Background="LightBlue">
                   
<Bold>How to create a ToolTip in WPF</Bold>
               
</Paragraph>
           
</Section>
           
<Section>
               
<Paragraph Background="Yellow">
                    By Manish Tewatia
               
</Paragraph>
           
</Section>
           
<Section>
 

                <Paragraph>

ToolTip is a ContentControl, is actually just a container like a panel or grid and pretty much anything that you can  put into a container you can now use in a tooltip. It is a very important part of any modern software. It helps and suggests what to do with any user interaction item control or what a particular content or legends means.

You use a ToolTip control to provide information to the user. For example, you can use a ToolTip to provide the name of a Button or a ToolBar in a ToolBarTray. You can also tweak various timing settings to control how quickly tooltips appear and disappear. The easiest way to show a tooltip doesn't involve using the ToolTip class directly. Instead, you simply set the ToolTip property of your element.

The ToolTip property is defined in the FrameworkElement class, so it's available on anything you'll place in a WPF window.

Example of an simple ToolTip

               
<Image Source="tool.gif" />
               
</Paragraph>
           
</Section>
       
</FlowDocument>   
</FlowDocumentReader>
</
Window>

Output Window

output-window.gif

Conclusion

Hope this article helps you understand the flow documents in WPF.
 

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.