I edited alot in this question, because it seems this issue is diffrent then i tought.
I decided to rewrite my whole question since somthing odd is happening: Im currently embedding WPF into my C# project for it to spell check but i've stumbled onto an quite odd issue
As you can see, i have an empty RichTextBox
I embedded a WPF richtextbox to C# like this:
System.Windows.Controls.RichTextBox richTextBox1 = new System.Windows.Controls.RichTextBox();
elementHost1.Child = richTextBox1;
omschrijving.SpellCheck.IsEnabled = true;
Now here is where to odd parts begins,
[Working] Example 1: (here i load a .rtf file into my textbox
TextRange range = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd);
FileStream stream = new FileStream("file_example.rtf", FileMode.Create, FileAccess.Write, FileShare.None);
range.Load(stream, DataFormats.Rtf);
stream.Close();
[Not working] Example 2: (here i load a .txt file into my textbox
TextRange range = new TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd);
FileStream stream = new FileStream("file_example.txt", FileMode.Create, FileAccess.Write, FileShare.None);
range.Load(stream, DataFormats.Text);
stream.Close();
[Not working] Example 3: (here i don't load a file, because i dont need to load a file, i just pass the string)
new System.Windows.Documents.TextRange(richTextBox1.Document.ContentStart, richTextBox1.Document.ContentEnd).Text = omschrijving_temp;
[Not working] Example 4: (here i don't load a file, because i dont need to load a file, i just append the string)
omschrijving.AppendText(omschrijving_temp);
Example 1 loads the text into the RichtTextBox, and then shows red dots on the text (spelling errors)
Example 2 loads the text into the RichtTextBox, and then ignores the spelling check
Example 3 loads the text into the RichtTextBox, and then ignores the spelling check
Example 4 loads the text into the RichtTextBox, and then ignores the spelling check
In all examples above, when i type in the richTextBox (after the text is appended), the spelling check works perfectly,
But it ignores the spelling check for the automaticly added text..
When appending text to the RichTextBox it seems to only work when its in a .RTF (richtext) format, else it just ignores the spellingcheck.
Is there any fix, is this a bug? or?