表題の通りですが、WPF の textBox で SpellCheck を試したいと思い下記のような簡単なサンプルを試しましたが、
ネット上に説明のあるような間違ったスペルの単語の下部に赤い波線など出てきません。
<Window x:Class="WpfApplication3.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WpfApplication3" mc:Ignorable="d" Title="MainWindow" Height="350" Width="525"> <Grid> <TextBox Name="text1" Width="300" Height="100" SpellCheck.IsEnabled="True" /> </Grid> </Window>
ビハインドコードは特になし。
ちょっと強引に下記のように文字全部チェックしようとしてもヌルしか返りません。
根本的に何か間違っている美でしょうか?
xaml
<Button Name="Check" Content="Check" Click="Check_Click"/>
cs
private void Check_Click(object sender, RoutedEventArgs e) { text1.SelectAll(); int txtLen = text1.SelectionLength; for (int i = 0; i < txtLen; i++) { var spellingError = text1.GetSpellingError(i); if(spellingError != null) { int a = 0; } } }
アプリ環境は、Windows10 VS2015 WPF C#
まだ回答がついていません
会員登録して回答してみよう