GHSoftware.Avalonia.SpellChecker.Avalonia11
0.3.3
dotnet add package GHSoftware.Avalonia.SpellChecker.Avalonia11 --version 0.3.3
NuGet\Install-Package GHSoftware.Avalonia.SpellChecker.Avalonia11 -Version 0.3.3
<PackageReference Include="GHSoftware.Avalonia.SpellChecker.Avalonia11" Version="0.3.3" />
<PackageVersion Include="GHSoftware.Avalonia.SpellChecker.Avalonia11" Version="0.3.3" />
<PackageReference Include="GHSoftware.Avalonia.SpellChecker.Avalonia11" />
paket add GHSoftware.Avalonia.SpellChecker.Avalonia11 --version 0.3.3
#r "nuget: GHSoftware.Avalonia.SpellChecker.Avalonia11, 0.3.3"
#:package GHSoftware.Avalonia.SpellChecker.Avalonia11@0.3.3
#addin nuget:?package=GHSoftware.Avalonia.SpellChecker.Avalonia11&version=0.3.3
#tool nuget:?package=GHSoftware.Avalonia.SpellChecker.Avalonia11&version=0.3.3
Avalonia Spell Checker
Avalonia Spell Checker adds Hunspell-based spell checking to Avalonia TextBox controls. It highlights misspelled words while the user types and adds spelling suggestions to the existing context menu without requiring a custom text input control.
<p float="left">
</p>
Features
- Real-time spell checking for Avalonia
TextBox. - Hunspell
.affand.dicdictionary support throughWeCantSpell.Hunspell. - Multiple enabled languages at the same time.
- Context menu suggestions for misspelled words.
- Custom ignored words.
- Automatic style registration when
TextBoxSpellChecker.Initializeis called. - Included dictionaries for
en_GB,es_MX, andpt_BR.
NuGet Packages
Use the package that matches your Avalonia major version:
| Avalonia version | Package | Target frameworks |
|---|---|---|
| Avalonia 12.x | GHSoftware.Avalonia.SpellChecker |
net8.0, net10.0 |
| Avalonia 11.1+ | GHSoftware.Avalonia.SpellChecker.Avalonia11 |
net6.0, net8.0, net10.0 |
Install the current Avalonia package:
dotnet add package GHSoftware.Avalonia.SpellChecker
Install the Avalonia 11 package:
dotnet add package GHSoftware.Avalonia.SpellChecker.Avalonia11
The two packages expose the same Avalonia.SpellChecker namespace and API. The separate package IDs keep NuGet dependency resolution explicit and avoid mixing Avalonia 11 and Avalonia 12 assets in the same package.
Usage
Create a TextBoxSpellChecker and initialize each TextBox that should be checked:
using Avalonia.Controls;
using Avalonia.SpellChecker;
public partial class MainWindow : Window
{
private readonly TextBoxSpellChecker _spellChecker;
public MainWindow()
{
InitializeComponent();
_spellChecker = new TextBoxSpellChecker(
SpellCheckerConfig.Create("pt_BR", "en_GB"));
var textBox = this.FindControl<TextBox>("DescriptionTextBox");
if (textBox is not null)
{
_spellChecker.Initialize(textBox);
}
}
}
By default, SpellCheckerConfig.Create(...) looks for dictionaries in:
<application output directory>/Dictionaries
The NuGet packages include the bundled dictionaries as content files and copy them to the output directory automatically.
After Initialize is called, the TextBoxSpellChecker starts checking the target TextBox as soon as its template is applied. Misspelled words are underlined, and suggestions are added to the context menu when the user right-clicks a misspelled word.
When the TextBox is detached from the logical tree, the spell checker removes its event handlers and clears its reference to that control.
Dictionaries
Hunspell dictionaries use a pair of files per language:
<language>.aff
<language>.dic
For example:
Dictionaries/pt_BR.aff
Dictionaries/pt_BR.dic
The bundled dictionaries are enough to start using the library. To add or replace dictionaries, use Hunspell-compatible files from maintained dictionary projects such as:
Then configure the folder explicitly if needed:
var config = SpellCheckerConfig.Create("en_GB");
config.DictionariesFolder = @"C:\path\to\Dictionaries";
Building Packages
The repository builds two NuGet packages: one for Avalonia 12 and one for Avalonia 11.
.\scripts\pack-all.ps1 -Configuration Release -Clean
To override the package version:
.\scripts\pack-all.ps1 -Configuration Release -Version 0.3.1 -Clean
Packages are written to:
artifacts/nuget
Current Limitations
- Keyboard-triggered context menus do not currently show spelling suggestions because suggestions are resolved from a pointer position.
- The included dictionaries are limited to
en_GB,es_MX, andpt_BR.
Contributing
Issues and pull requests are welcome.
License
This project is licensed under the MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Avalonia (>= 11.1.0 && < 12.0.0)
- WeCantSpell.Hunspell (>= 7.0.1)
-
net6.0
- Avalonia (>= 11.1.0 && < 12.0.0)
- WeCantSpell.Hunspell (>= 6.0.4)
-
net8.0
- Avalonia (>= 11.1.0 && < 12.0.0)
- WeCantSpell.Hunspell (>= 7.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.