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.
Comments
Anonymous
October 26, 2009
Why can't you add to the dictionary?Anonymous
October 26, 2009
this does add to the dictionary.. as in the example above, other than the first suggestion, the others are from the default dictionaryAnonymous
October 26, 2009
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? ...StefanAnonymous
October 26, 2009
yes you can create your own custom menu and populate it based on the speller api's