WPF spellcheck richtextbox retry












1















I'm currently embedding WPF into my C# project for it to spell check, but I've stumbled onto quite an odd issue.



As you can see, I have an empty RichTextBox



I embedded a WPF rich text box 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 the odd part begins:



[Working] Example 1: (here I load an .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 don't need to, instead 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 don't need to, instead I just append the string)



omschrijving.AppendText(omschrijving_temp);


Example 1 loads the text into the RichTextBox, and then shows red dots on the text (spelling errors).



Example 2 loads the text into the RichTextBox, and then ignores the spelling check.



Example 3 loads the text into the RichTextBox, and then ignores the spelling check.



Example 4 loads the text into the RichTextBox, and then ignores the spelling check.



In all the 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 automatically added text.



When appending text to the RichTextBox it seems to work only when it's in a .RTF (richtext) format; otherwise it just ignores the spelling check.



Is there any fix, is this a bug? or?










share|improve this question

























  • What is omschrijving?  Something like Application? Do you mean System?

    – Scott
    Jan 24 at 20:43
















1















I'm currently embedding WPF into my C# project for it to spell check, but I've stumbled onto quite an odd issue.



As you can see, I have an empty RichTextBox



I embedded a WPF rich text box 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 the odd part begins:



[Working] Example 1: (here I load an .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 don't need to, instead 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 don't need to, instead I just append the string)



omschrijving.AppendText(omschrijving_temp);


Example 1 loads the text into the RichTextBox, and then shows red dots on the text (spelling errors).



Example 2 loads the text into the RichTextBox, and then ignores the spelling check.



Example 3 loads the text into the RichTextBox, and then ignores the spelling check.



Example 4 loads the text into the RichTextBox, and then ignores the spelling check.



In all the 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 automatically added text.



When appending text to the RichTextBox it seems to work only when it's in a .RTF (richtext) format; otherwise it just ignores the spelling check.



Is there any fix, is this a bug? or?










share|improve this question

























  • What is omschrijving?  Something like Application? Do you mean System?

    – Scott
    Jan 24 at 20:43














1












1








1


1






I'm currently embedding WPF into my C# project for it to spell check, but I've stumbled onto quite an odd issue.



As you can see, I have an empty RichTextBox



I embedded a WPF rich text box 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 the odd part begins:



[Working] Example 1: (here I load an .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 don't need to, instead 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 don't need to, instead I just append the string)



omschrijving.AppendText(omschrijving_temp);


Example 1 loads the text into the RichTextBox, and then shows red dots on the text (spelling errors).



Example 2 loads the text into the RichTextBox, and then ignores the spelling check.



Example 3 loads the text into the RichTextBox, and then ignores the spelling check.



Example 4 loads the text into the RichTextBox, and then ignores the spelling check.



In all the 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 automatically added text.



When appending text to the RichTextBox it seems to work only when it's in a .RTF (richtext) format; otherwise it just ignores the spelling check.



Is there any fix, is this a bug? or?










share|improve this question
















I'm currently embedding WPF into my C# project for it to spell check, but I've stumbled onto quite an odd issue.



As you can see, I have an empty RichTextBox



I embedded a WPF rich text box 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 the odd part begins:



[Working] Example 1: (here I load an .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 don't need to, instead 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 don't need to, instead I just append the string)



omschrijving.AppendText(omschrijving_temp);


Example 1 loads the text into the RichTextBox, and then shows red dots on the text (spelling errors).



Example 2 loads the text into the RichTextBox, and then ignores the spelling check.



Example 3 loads the text into the RichTextBox, and then ignores the spelling check.



Example 4 loads the text into the RichTextBox, and then ignores the spelling check.



In all the 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 automatically added text.



When appending text to the RichTextBox it seems to work only when it's in a .RTF (richtext) format; otherwise it just ignores the spelling check.



Is there any fix, is this a bug? or?







c# wpf






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 24 at 20:43









Scott

15.9k113990




15.9k113990










asked Jan 23 at 23:58









ImNoSTNImNoSTN

61




61













  • What is omschrijving?  Something like Application? Do you mean System?

    – Scott
    Jan 24 at 20:43



















  • What is omschrijving?  Something like Application? Do you mean System?

    – Scott
    Jan 24 at 20:43

















What is omschrijving?  Something like Application? Do you mean System?

– Scott
Jan 24 at 20:43





What is omschrijving?  Something like Application? Do you mean System?

– Scott
Jan 24 at 20:43










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397693%2fwpf-spellcheck-richtextbox-retry%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1397693%2fwpf-spellcheck-richtextbox-retry%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Список кардиналов, возведённых папой римским Каликстом III

Deduzione

Mysql.sock missing - “Can't connect to local MySQL server through socket”