This is a migrated thread and some comments may be shown as answers.

RadDocument - How to add PageField in XAML

1 Answer 129 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Dustin
Top achievements
Rank 1
Dustin asked on 29 Sep 2011, 01:17 PM
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>


1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 04 Oct 2011, 12:32 PM
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 >>

Tags
RichTextBox
Asked by
Dustin
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or