SpellCheck.CustomDictionaries 속성

정의

사용자 지정 맞춤법 검사에 사용되는 용어 파일 위치의 컬렉션을 가져옵니다.

public:
 property System::Collections::IList ^ CustomDictionaries { System::Collections::IList ^ get(); };
public System.Collections.IList CustomDictionaries { get; }
member this.CustomDictionaries : System.Collections.IList
Public ReadOnly Property CustomDictionaries As IList

속성 값

용어 파일 위치의 컬렉션입니다.

예제

다음 예제에서는 에 두 개의 사용자 지정 사전을 RichTextBox추가하는 방법을 보여 있습니다. 첫 번째 사용자 지정 사전(customwords.lex)이 XAML에 추가됩니다. 파일 콘텐츠 파일을 애플리케이션에 포함 된 이며 출력 디렉터리에 복사 합니다. 요소를 사용 Uri 하려면 시스템 네임스페이스를 포함해야 합니다.

xmlns:sys="clr-namespace:System;assembly=System"

두 번째 사용자 지정 사전(customwords2.lex)이 이벤트 처리기에 추가 Click 됩니다. 파일을 리소스 파일로 포함 되어 있으며 WPFCustomDictionary 이라고 하는 애플리케이션 어셈블리에 컴파일됩니다.

<RichTextBox Margin="38,18,40,0" Name="richTextBox1" Height="45" VerticalAlignment="Top" SpellCheck.IsEnabled="True" >
    <SpellCheck.CustomDictionaries>
        <!-- customwords.lex is included as a content file-->
        <sys:Uri>pack://application:,,,/customwords.lex</sys:Uri>
    </SpellCheck.CustomDictionaries>
</RichTextBox>
private void button1_Click(object sender, RoutedEventArgs e)
{
    IList dictionaries = SpellCheck.GetCustomDictionaries(richTextBox1);
    // customwords2.lex is included as a resource file
    dictionaries.Add(new Uri(@"pack://application:,,,/WPFCustomDictionary;component/customwords2.lex"));
}
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs)
    Dim dictionaries As IList = SpellCheck.GetCustomDictionaries(richTextBox1)
    ' customwords2.lex is included as a resource file
    dictionaries.Add(New Uri("pack://application:,,,/WPFCustomDictionary;component/customwords2.lex"))
End Sub

설명

사용자 지정 사전은 .lex 확장명이 있는 텍스트 파일인 어휘집 파일을 사용합니다. 어휘집 파일의 각 줄에는 합법적인 맞춤법으로 허용되는 한 단어가 포함되어 있습니다. 파일의 첫 번째 줄은 사전이 적용되는 LCID(로캘 식별자)를 지정할 수 있습니다. 로캘을 지정하지 않으면 사전이 모든 언어에 적용됩니다. 자세한 내용은 로캘 ID를 참조하세요. 다음 예제에서는 영어에 대한 어휘집 파일의 처음 몇 줄을 보여줍니다.

#LID 1033  
TextBlock  
TextBox  
ListBox  

에서 파생된 TextBoxBase클래스에 대해 또는 에 대해 TextBox 하나 이상의 사용자 지정 사전을 지정하려면 컬렉션에 파일의 URI를 추가하여 어휘집 파일 CustomDictionaries 의 위치를 지정합니다.

참고

를 사용하여 Insert 컬렉션에 파일을 CustomDictionaries 추가하면 예외가 발생합니다. 대신 및 Remove 을 사용하여 Add 컬렉션을 업데이트합니다.

어휘 집 파일을 포함할 수 애플리케이션을 로컬에 컴파일된 리소스 파일 또는 로컬 컴퓨터에 설치 된 콘텐츠 파일에서 어셈블리를 참조 합니다. pack URI를 사용하여 파일을 참조할 수 있습니다. 자세한 내용은 WPF의 Pack URI를 참조하세요.

맞춤법 검사기를 사용하려면 에서 파생TextBoxBase되는 클래스의 또는 에서 속성을 TextBoxtrue 로 설정합니다SpellCheck.IsEnabled. 에 대한 TextBox 모든 사용자 지정 사전은 기본 맞춤법 검사기 외에도 사용됩니다. 맞춤법 검사에 대한 자세한 내용은 를 참조하세요 SpellCheck.

적용 대상

추가 정보