I know I have seen this problem before somewhere, but I'm not sure if there was an answer at the time. I'm trying to add SpellCheck to a TextBox
in WPF, .NET 4.0. It works fine in terms of finding and marking the incorrect words, and will replace the first word in the TextBox
if it's incorrect. Anything past word one though, and it just moves the carat to the start of the TextBox
without changing anything? As I said I saw this somewhere about 6-9 months ago, but now everything I come up with in google deals with alternate languages (I'm staying strictly in English for now). I've included the event methods and styling XAML only for completeness, I don't think the issue lies there.
XAML:
<MultiBox:MultiBox Name="callNotes" Grid.Column="1" Width="Auto" Height="Auto" Margin="2,5,15,20" VerticalAlignment="Stretch" AcceptsReturn="True" FontWeight="Bold" GotFocus="callNotes_GotFocus" SelectAllOnGotFocus="False" SpellCheck.IsEnabled="True" xml:lang="en-US" Style="{StaticResource TextBoxStyle}" TextChanged="callNotes_TextChanged" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" />
<Style x:Key="TextBoxStyle" TargetType="{x:Type MyNamespace:MultiBox}">
<Setter Property="CharacterCasing" Value="Upper" />
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Height" Value="23" />
<Setter Property="Width" Value="Auto" />
<Setter Property="SelectAllOnGotFocus" Value="True" />
<Setter Property="TextWrapping" Value="Wrap" />
</Style>
Code:
private void callNotes_TextChanged(object sender, TextChangedEventArgs e)
{
callNotes.Text.ToUpper();
lineCountOne.Content = ((callNotes.Text.Length / 78) + 1);
}
private void callNotes_GotFocus(object sender, RoutedEventArgs e)
{
callNotes.CaretIndex = callNotes.Text.Length;
}