Welcome to MSDN Blogs Sign in | Join | Help

Lester's WPF blog


Simple, easy & beautiful

News

New WPF Features: Custom Speller Dictionary

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

 

Posted: Monday, October 26, 2009 3:22 PM by llester

Comments

Stefan Olson said:

Why can't you add to the dictionary?

# October 26, 2009 11:12 AM

llester said:

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

# October 26, 2009 12:38 PM

Stefan Olson said:

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

# October 26, 2009 1:28 PM

llester said:

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

# October 26, 2009 1:52 PM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker