Procedura: attivare il controllo ortografico in un controllo di modifica del testo
Nell'esempio seguente viene illustrato come abilitare il controllo ortografico in tempo reale in un TextBox utilizzando la IsEnabled proprietà della SpellCheck classe .
Esempio
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel>
<TextBox SpellCheck.IsEnabled="True" Name="myTextBox"></TextBox>
</StackPanel>
</Page>
using System;
using System.Windows;
using System.Windows.Controls;
namespace SDKSample
{
public partial class SpellCheckExample : Page
{
public SpellCheckExample()
{
StackPanel myStackPanel = new StackPanel();
//Create TextBox
TextBox myTextBox = new TextBox();
myTextBox.Width = 200;
// Enable spellchecking on the TextBox.
myTextBox.SpellCheck.IsEnabled = true;
// Alternatively, the SetIsEnabled method could be used
// to enable or disable spell checking like this:
// SpellCheck.SetIsEnabled(myTextBox, true);
myStackPanel.Children.Add(myTextBox);
this.Content = myStackPanel;
}
}
}
Imports System.Windows
Imports System.Windows.Controls
Namespace SDKSample
Partial Public Class SpellCheckExample
Inherits Page
Public Sub New()
Dim myStackPanel As New StackPanel()
'Create TextBox
Dim myTextBox As New TextBox()
myTextBox.Width = 200
' Enable spellchecking on the TextBox.
myTextBox.SpellCheck.IsEnabled = True
' Alternatively, the SetIsEnabled method could be used
' to enable or disable spell checking like this:
' SpellCheck.SetIsEnabled(myTextBox, True)
myStackPanel.Children.Add(myTextBox)
Me.Content = myStackPanel
End Sub
End Class
End Namespace
Vedi anche
Collabora con noi su GitHub
L'origine di questo contenuto è disponibile in GitHub, in cui è anche possibile creare ed esaminare i problemi e le richieste pull. Per ulteriori informazioni, vedere la guida per i collaboratori.
.NET Desktop feedback
Commenti e suggerimenti
https://aka.ms/ContentUserFeedback.
Presto disponibile: Nel corso del 2024 verranno gradualmente disattivati i problemi di GitHub come meccanismo di feedback per il contenuto e ciò verrà sostituito con un nuovo sistema di feedback. Per altre informazioni, vedereInvia e visualizza il feedback per