dotnet / dotnet/wpf

WPF on .NET 8.0 > TextBox.SpellCheck custom dictionary has no effect

Open
#9,760 12 comments 3 reactions 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

_This issue has been moved from [a ticket on Developer Community](https://developercommunity.visualstudio.com/t/WPF-on-NET-80--TextBoxSpellCheck-cus/10741997)._

---
[severity:I'm unable to use this version]
Hello,

I am currently facing the problem that the SpellCheck of the TextBox WPF-Control does not seem to load my lexicon file correctly.

Per documentation I am using the following code to load the dictionary:

```
txtContent.Language = System.Windows.Markup.XmlLanguage.GetLanguage("de-DE");
txtContent.SpellCheck.CustomDictionaries.Clear();
txtContent.SpellCheck.CustomDictionaries.Add(new Uri(@"C:\temp\test.lex", UriKind.Absolute));
txtContent.SpellCheck.IsEnabled = true;
```

The TextBox is defined in XAML as follows:

```

```

The file "test.lex" contains the following lines:

```
#LID 1031
Datenbox
Dokumentenboard
Infoboard
```

Still, when I type the word "Datenbox" in the TextBox control, it underlines the word and tries to correct it.

When I retrieve the custom dictionaries using "SpellCheck.GetCustomDictionaries", I can see that the dictionary was in fact loaded. It just isn't applied for some reason.

Project Information:

```
net8.0-windows10.0.22621.0
enable
enable
true
x64
```

Any help or hints would be greatly appreciated!

Kind regards,
Lukas

---
### Original Comments

#### Feedback Bot on 9/11/2024, 07:10 AM:

(private comment, text removed)

---
### Original Solutions
(no solutions)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.