RadDocument - How to add PageField in XAML

2 posts, 0 answers
  1. Dustin
    Dustin avatar
    79 posts
    Member since:
    Oct 2012

    Posted 29 Sep 2011 Link to this post

    I have seen plenty of examples on how to add PageFields to a RadDocument using c#, but I can't figure out how to do it using xaml. Does anyone know how to add a Page field to a Header/Footer in xaml. Below is an example of the code I am using with a comment where I need my PageField to go.

    <telerik:RadDocument x:Key="Footer_Base">
            <telerik:Section>
                <telerik:Table Borders="0 None #00FFFFFF">
                    <telerik:TableRow>
                        <telerik:TableCell Padding="{StaticResource HeaderFooter_TableCell_Padding}">
                            <telerik:Paragraph>
                                <telerik:Span Text="Presented by ??"
                                              FontSize="{StaticResource HeaderFooter_Span_FontSize}"
                                              ForeColor="{StaticResource HeaderFooter_Forecolor}" />
                            </telerik:Paragraph>
                        </telerik:TableCell>
                        <telerik:TableCell Padding="{StaticResource HeaderFooter_TableCell_Padding}" TextAlignment="Right">
                            <telerik:Paragraph>
                                          <!-- WHERE I NEED PAGEFIELD -->
                            </telerik:Paragraph>
                        </telerik:TableCell>
                    </telerik:TableRow>
                </telerik:Table>
            </telerik:Section>
        </telerik:RadDocument>


  2. Iva Toteva
    Admin
    Iva Toteva avatar
    1319 posts

    Posted 04 Oct 2011 Link to this post

    Hi Dustin,

    Here is how you can add a PageField declaratively to the footer of a document:

    <telerik:RadRichTextBox Grid.Row="1" x:Name="editor" Margin="24 24 0 0" AllowDrop="True" LayoutMode="Paged" >
        <telerik:RadDocument FieldsDisplayMode="Result" >
            <telerik:Section>
                <telerik:Section.Footers>
                    <telerik:Footers>
                        <telerik:Footers.Default>
                            <telerik:Footer>
                                <telerik:Footer.Body>
                                    <telerik:RadDocument>
                                        <telerik:Section>
                                            <telerik:Table Borders="0 None #00FFFFFF">
                                                <telerik:TableRow>
                                                    <telerik:TableCell >
                                                        <telerik:Paragraph>
                                                            <telerik:Span Text="Presented by ??" />
                                                        </telerik:Paragraph>
                                                    </telerik:TableCell>
                                                    <telerik:TableCell TextAlignment="Right">
                                                        <telerik:Paragraph>
                                                            <t:FieldRangeStart AnnotationID="1">
                                                                <t:PageField DisplayMode="DisplayName" />
                                                            </t:FieldRangeStart>
                                                            <t:Span Text="1" />
                                                            <t:FieldRangeEnd AnnotationID="1" />
                                                        </telerik:Paragraph>
                                                    </telerik:TableCell>
                                                </telerik:TableRow>
                                            </telerik:Table>
                                        </telerik:Section>
                                    </telerik:RadDocument>
                                </telerik:Footer.Body>
                            </telerik:Footer>
                        </telerik:Footers.Default>
                    </telerik:Footers>
                </telerik:Section.Footers>
            </telerik:Section>
        </telerik:RadDocument>
    </telerik:RadRichTextBox>

    Whenever you need to know how to construct a document in XAML, you can create the document in the editor and export it to XAML. More often than not, the exported XAML is exactly what you need.

    All the best,
    Iva
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
Back to Top