Hi,
Let' say in the rich text editor we have 'XXasdf' text. If I added italic style to the 'XX' part, XamSpellChecker would treat 'XX' and 'asdf' as two different word nodes (TextNodes). How this behaviour can be avoided? Is it known issue?
Regards
Hello Darius,
Is it possible to provide an isolated sample reproducing the described behavior?
Thanks,
readonly List<TextNode> _spellCheckNodes = new List<TextNode>();
private void SpellCheck(){ _spellCheckNodes.Clear();
AddTextNodes(richTextEditor.Document.RootNode.ChildNodes, _spellCheckNodes);
AddBindingsToSpell();}
private void AddTextNodes(NodeCollection nodes, IList<TextNode> textNodes){ foreach (var node in nodes) { if (node is TextNode) { textNodes.Add(node); } if(node.HasChildNodes) AddTextNodes(node.ChildNodes, textNodes); }}
private void AddBindingsToSpell(){ spellChecker.SpellCheckTargets.Clear();
foreach (TextNode node in _spellCheckNodes) { Binding bind = new Binding("Text") { Source = node, Mode = BindingMode.TwoWay };
spellChecker.SpellCheckTargets.Add(bind); }
spellChecker.SpellCheck();}
Rich text document parts are stored as TextNodes. If I applied different style to the part of some word, it would appear in two different textnodes. Thus it is not possible to correctly check spelling of the word.