How to set the font for page numbers

3 posts, 1 answers
  1. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 27 Jul 2012 Link to this post

    I know there must be a way to set the font of the page numbers generated by PageField, but I can't figure it out.  Also, there are 3 formatting strings, but I can't find any documentation on how they are used.
    Thanks,
    Steve
  2. Answer
    Petya
    Admin
    Petya avatar
    975 posts

    Posted 01 Aug 2012 Link to this post

    Hello Steve,

    The setting of the style of the fields is indeed not very intuitive. What you can do is create a span with the desired formatting and add it between the field start and field end. It will be used by the field to retrieve the formatting, but the value of the text will be overwritten in order to show the result of the field: 

    Paragraph paragraph = new Paragraph();
    PageField pageField = new PageField()
    {
        DisplayMode = FieldDisplayMode.Result
    };
    FieldRangeStart pageFieldStart = new FieldRangeStart();
    pageFieldStart.Field = pageField;
    FieldRangeEnd pageFieldEnd = new FieldRangeEnd();
    pageFieldEnd.Start = pageFieldStart;
    paragraph.Inlines.Add(pageFieldStart);
    paragraph.Inlines.Add(new Span("1") { FontSize = 9});
    paragraph.Inlines.Add(pageFieldEnd);

    As for the other matter, I believe you are refering to PageFields'  properties DateTimeFormatting, NumericFormatting and GeneralFormatting. They are used mostly internally or when implementing a custom Field and can't be used for styling the page field.  Regards,
    Petya
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Steve
    Steve avatar
    124 posts
    Member since:
    Jun 2011

    Posted 01 Aug 2012 Link to this post

    Worked like a charm!
    Thanks,
    Steve
Back to Top