Lester's WPF\SL Blog

Simple, Easy & Beautiful

New WPF Features: Custom Speller Dictionary

New WPF Features: Custom Speller Dictionary

Rate This
  • Comments 4

This is part of a series on New WPF Features

In previous versions, adding a custom dictionary was an unsupported scenario. You could still do it but it required writing a bunch of code.

In this release, we have provided suport for adding custom dictionaries.

     <RichTextBox FontSize="24" SpellCheck.IsEnabled="true" >

            <SpellCheck.CustomDictionaries>

                  <sys:Uri>Dictionary1.lex</sys:Uri>

                  <sys1:Uri>\\dictServer\Dictionary3.txt</sys1:Uri>          

            </SpellCheck.CustomDictionaries>

            <FlowDocument>

                  <Paragraph>Some Names: Zorig Lester </Paragraph>

                  <Paragraph>Misspelled: Zorg BlahBlah </Paragraph>

            </FlowDocument>

      </RichTextBox>

The dictionaries are plain text files and list the words to be updated.

For a non default locale (en-us) you can specify the locale ID at the top (#LID localeID). In the pic above, we are using the locale 2057 which corresponds to english-UK.

 

Share this post

 

  • Why can't you add to the dictionary?

  • this does add to the dictionary.. as in the example above, other than the first suggestion, the others are from the default dictionary

  • Sorry, what I meant was that there should be an add to dictionary option in that context menu, otherwise users are forever seeing the same errors. However, I understand why it isn't there by default.

    Can I build my own context menu which has an add to dictionary, which adds it to the text file?

    ...Stefan

  • yes you can create your own custom menu and populate it based on the speller api's

Page 1 of 1 (4 items)