Sunday, 20 April 2014

Load the Flow Document from Resource Dictionary Xaml

In this article we are going to see how to load a Flow document from the Resource dictionary, Describe the style for the FlowdocumentPageViewer and define the Flow Document data there in the resource dictionary along with key name, which is used to reference later using that key.

<ResourceDictionary xmlns=""
<FlowDocument x:Key="doctext">
    <Paragraph> <Bold>Mouse Operations</Bold></Paragraph>
        <ListItem><Paragraph>Left Click = Menu options</Paragraph></ListItem>
        <ListItem><Paragraph>Right Click = Ok </Paragraph></ListItem>
    <Paragraph><Bold>Keyboard Shortcuts</Bold></Paragraph>
        <ListItem><Paragraph>Ctrl + a = Select All</Paragraph></ListItem>
            <ListItem><Paragraph>Ctrl + Click = Item selected</Paragraph></ListItem>
    <Style TargetType="{x:Type FlowDocumentPageViewer}">
        <Setter Property="Template">
                <ControlTemplate TargetType="{x:Type FlowDocumentPageViewer}">


Now create a reference in the main window by adding the resource dictionary in the window resources.

                <ResourceDictionary Source="Helptext.xaml"></ResourceDictionary>


Code for the main window 

        <FlowDocumentPageViewer Document="{StaticResource doctext}"></FlowDocumentPageViewer>



from this article you can see how to use the resource dictionary in the another window.

No comments:

Post a Comment