Note that there are some explanatory texts on larger screens.

plurals
  1. POIs this a bug in DotNet 4 WPF Spell Checking?
    primarykey
    data
    text
    <p>I have:</p> <ol> <li>Created a Windows forms project.</li> <li>Created a UserControl to hold a WPF TextBox.</li> <li>Added a CustomDictionary to the TextBox's SpellCheck.</li> <li>Added the UserControl to my Windows Form.</li> </ol> <p>XAML is used to add the WPF textbox to the user control:</p> <pre><code>&lt;UserControl x:Class="TestElementHost.SpellBox" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" d:DesignHeight="248" d:DesignWidth="250"&gt; &lt;Grid&gt; &lt;TextBox Name="txtWPF" /&gt; &lt;/Grid&gt; &lt;/UserControl&gt; </code></pre> <p>Here is the form code (buttons added in the VS designer file):</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace TestElementHost { public partial class Form1 : Form { private System.Windows.Forms.Integration.ElementHost elementHost1; private SpellBox spellBox1; public Form1() { InitializeComponent(); this.elementHost1 = new System.Windows.Forms.Integration.ElementHost(); this.spellBox1 = new TestElementHost.SpellBox(); this.elementHost1.Location = new System.Drawing.Point(27, 12); this.elementHost1.Name = "elementHost1"; this.elementHost1.Size = new System.Drawing.Size(269, 296); this.elementHost1.TabIndex = 0; this.elementHost1.Text = "elementHost1"; this.elementHost1.Child = this.spellBox1; this.Controls.Add(this.elementHost1); } private void Form1_Load(object sender, EventArgs e) { spellBox1.txtWPF.SpellCheck.IsEnabled = true; spellBox1.txtWPF.SpellCheck.CustomDictionaries.Add(new Uri(Application.StartupPath + @"\MyDictionary.lex")); } private void button1_Click(object sender, EventArgs e) { spellBox1.txtWPF.Text = "my bbad word."; // bbad is in the CustomDictionary } private void button2_Click(object sender, EventArgs e) { spellBox1.txtWPF.IsEnabled = false; spellBox1.txtWPF.IsEnabled = true; // spellBox1.txtWPF.SpellCheck.IsEnabled = false; // spellBox1.txtWPF.SpellCheck.IsEnabled = true; } } } </code></pre> <p>This works quite happily and words in the CustomDictionary are ignored, until I try changing the IsEnabled, IsReadOnly or the Visibility property. For example, set IsReadOnly to true then straight back to false again and suddenly words that are in the customdictionary are redlined.</p> <p>The way I am getting round this is to set SpellCheck.IsEnabled to false then back to true on consecutive lines when I need to allow users to edit text in the control. This seems to bring the customdictionary back into play.</p> <p>Has anyone else had this problem? Is this a bug or have I missed something?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload