Search code examples
c#.netwpf

SpellCheck overwrite in entire wpf application


Is there a way how i can overwrite in my entire application the spellcheck. I know how i can do it on the single properties but not in my entire application.My goal is If a language pack is not installed i want to disable the spellcheck in my entire application. At the moment it is sometimes enabled and sometimes disabled.

The reason for that is that the SpellCheck will fail if the required language pack is no installed so i want to check if the language pack is installed on the start and if not disable it.


Solution

  • Try to define an implicit Style in App.xaml that sets the SpellCheck.IsEnabled property to false:

    <Style TargetType="RichTextBox">
        <Setter Property="SpellCheck.IsEnabled" Value="False" />
    </Style>
    

    This Style will get applied to all RichTextBox elements in the application.

    If you want to enable spell checking for an individual control, you could just set the property for this one to override the default value set by the Style:

    <RichTextBox SpellCheck.IsEnabled="True" />