zoukankan      html  css  js  c++  java
  • WPF 文本拼写检查 分类: .NET 20120523 15:30 666人阅读 评论(0) 收藏

    开发环境:xp sp3、vs2010、.net4.0(.net3.5没有SpellCheck.CustomDictionaries)



    代码:

    <Window x:Class="aaa.MainWindow"
            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:sys="clr-namespace:System;assembly=System"
            Title="MainWindow" Height="350" Width="525">
        <Grid>
            <TextBox x:Name="txtBox" SpellCheck.IsEnabled="True" Language="en-us"   Margin="24,17,0,0" Height="19" VerticalAlignment="Top" HorizontalAlignment="Left" Width="211">
                <SpellCheck.CustomDictionaries>
                    <sys:Uri>pack://application:,,,/lexicon/word.lex</sys:Uri>
                </SpellCheck.CustomDictionaries>
            </TextBox>
        </Grid>
    </Window>

    
    

    因为文本框中的单词WPF并不是错误,只是系统不能识别这个单词,所以通过自定义字典来解决这个问题,

    首先打开Notepad 编写词典文件(.lex),在文件中按以下格式编写单词内容(关于语言对应的ID请参考http://msdn.microsoft.com/en-us/goglobal/bb964664.aspx):

    #LID 1033
    WPF
    Word2
    Word3
    


    将字典文件放到项目的lexicon目录下:


    备注:单纯的文字拼写检查本人验证过,但自定义字典没有成功,在xaml中编辑代码时发现sys下没有Uri,不知道怎么回事,有知道的请告知下,在此感谢!


    文章参考:http://www.cnblogs.com/gnielee/archive/2010/05/04/1727133.html

    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    Angularjs 中文版API v1.3.9 阅读
    jquery之ajax
    requirejs中 shim
    reqiurejs学习
    angularjs与require的集成摘抄
    安装go-admin
    多种GitHub加速方式
    git初始化仓库操作
    git cherry-pick
    gc问题定位
  • 原文地址:https://www.cnblogs.com/configman/p/4657587.html
Copyright © 2011-2022 走看看