表題の通りですが、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
1<Button Name="Check" Content="Check" Click="Check_Click"/>
cs
1 private void Check_Click(object sender, RoutedEventArgs e) 2 { 3 text1.SelectAll(); 4 int txtLen = text1.SelectionLength; 5 6 for (int i = 0; i < txtLen; i++) 7 { 8 var spellingError = text1.GetSpellingError(i); 9 10 if(spellingError != null) 11 { 12 int a = 0; 13 } 14 } 15 }
アプリ環境は、Windows10 VS2015 WPF C#

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/02/26 11:48 編集
2020/02/26 11:55
2020/02/26 12:01
2020/02/27 00:15