c# - 在 .Net 3.5 上使用 ICSharpCode.AvalonEdit?

标签 c# .net text-editor sharpdevelop avalonedit

我正在尝试在我正在构建的 WPF 应用程序中使用来自 SharpDevelop 4.0 项目的 ICSharpCode.AvalonEdit.TextEditor 控件,但我似乎无法让它工作。

我从 svn://svnmirror.sharpdevelop.net/sharpdevelop/trunk/SharpDevelop/src/Libraries/AvalonEdit 中查看了版本为 4304 的源代码副本。然后,我使用 Visual Studio 2008 SP1 构建了项目,成功,没有错误。

然后我创建了一个空白的新 WPF 项目,将构建 DLL 添加到工具箱并将 TextEditor 控件放到默认的空窗口中,如下所示:

<Window x:Class="AvalonEditTest.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"        
    Title="Window1" Height="300" Width="300" >
    <Grid x:Name="LayoutRoot">
        <avalonedit:TextEditor Name="textEditor" />
    </Grid>
</Window>

但是,当我运行该项目时,出现的表单完全是空白的。没有插入符,鼠标光标保持默认指针,窗口不响应按键。

我是不是遗漏了什么,或者 AvalonEdit 只是有点坏了?

[编辑:我开始认为这可能与我的特定设置有关。我正在运行 64 位 Windows 7 RC。这可能与它有关吗?我试过只为 x86 构建它,没有任何区别。]

最佳答案

你确定你的命名空间声明是正确的吗?

你可以尝试这样的事情:

<Window x:Class="Editor.Window1"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="Window1" Height="300" Width="300" 
    xmlns:e="clr-namespace:ICSharpCode.AvalonEdit;assembly=ICSharpCode.AvalonEdit">
    <Grid>
        <e:TextEditor x:Name="Editor" WordWrap="True" Height="200">          
        </e:TextEditor>
    </Grid>
</Window>

我能够毫无问题地使用它。

关于c# - 在 .Net 3.5 上使用 ICSharpCode.AvalonEdit?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1020447/

相关文章:

c# - Visual Studio 用户控件设计

css - vim 中凌乱的 css 缩进

C# 加入线程

c# - 如何在 WPF XAML 中填充饼形区域

c# - 在 Linux 上编写 C# 程序时缺少类型 'Uri'

.net - Monitor.TryEnter(object) 和 Monitor.TryEnter(object, ref bool) 之间存在什么重要区别?

mysql - 在线 SQL 编辑器(或不),自动将 sql 命令大写(例如 SELECT、AND、THEN、DISTINCT、DROP...)

javascript - TinyMCE 未在工具栏中显示 "hr"

c# - 表单在另一台计算机上看起来不同

c# - 当不抛出异常时,try/catch block 会影响性能吗?