Modify ListStyle Numbering Format

3 posts, 0 answers
  1. deri
    deri avatar
    4 posts
    Member since:
    Sep 2016

    Posted 20 Sep Link to this post


    For some reason i have to create custom liststyle based on existing one. You can find the detail in the attached picture. So is it possible to create these things? I've spent almost a a week and still stuck in this mess.

    thanks in advance, and sorry for my bad english.


  2. Deyan
    Deyan avatar
    126 posts

    Posted 23 Sep Link to this post

    Hello Deri,

    Thank you for contacting us.

    In this ListStyle documentation article you can find detailed description on how to build custom list appearance. Basically, the numbering representation depends on ListLevelStyle NumberingFormat and LevelText properties. Using UpperLetter numbering format and appropriate level text you may make numbers appear as "AAA", "BBB", "CCC". However, there is no numbering format allowing you to convert numbers to the words "ONE", "TWO", "THREE". With the following code, you may create custom list style and build document similar to the attached screenshot:
    RadDocument document = this.radRichTextBox.Document;
    RadDocumentEditor editor = new RadDocumentEditor(document);
    ListStyle listStyle = new ListStyle();
    for (int i = 0; i < 9; i++)
        bool isEven = (i & 1) == 0;
        ListLevelStyle listLevel = new ListLevelStyle();
        listLevel.StartingIndex = 1;
        listLevel.NumberingFormat = isEven ? ListNumberingFormat.UpperLetter : ListNumberingFormat.Decimal;
        listLevel.Indent = 48 + (24 * i);
        listLevel.LevelText = isEven ? string.Format("{0}{1}{2}{0}{1}{2}{0}{1}{2} DOT ", '{', i, '}') : string.Format("{0}{1}{2} DOT ", '{', i, '}');
        listLevel.FontWeight = FontWeights.Bold;
    editor.Insert("First level first item");
    editor.Insert("Second level first item");
    editor.Insert("Second level second item");
    editor.Insert("Third level first item");
    editor.Insert("Second level third item");
    editor.Insert("First level second item");
    editor.Insert("Some text outside the list.");

    I hope this is helpful. If you have any other questions or concerns please do not hesitate to contact us again.

    Telerik by Progress
    Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
  4. deri
    deri avatar
    4 posts
    Member since:
    Sep 2016

    Posted 26 Sep in reply to Deyan Link to this post

    Hi Deyan,

    Thanks for response, but i had achieved the result like yours before i had submit this thread. The reason why i have to customize/convert the numbering format to words format is application that i made doesn't allowing to use any number/symbol in the document. Thanks anyway, Telerik documentation is help me a lot from building my apps.

Back to Top