我用AvalonEdit:TextEditor.我可以为此控件启用快速搜索对话框(例如在Ctrl-F上)吗?或者也许有人将搜索词的代码转换为 AvalonEdit:TextEditor文本?
有没有一种简单的方法可以使用Avalon编辑来突出显示匹配的括号和其他字符,如{}""?
我想在我的代码中更改AvalonEdit的语法突出显示.
XAML:
<avalonEdit:TextEditor Name="textEditor" SyntaxHighlighting="{Binding syntaxHighlighting}" />
Run Code Online (Sandbox Code Playgroud)
C#:
public string syntaxHighlighting { get; set; }
public MainWindow()
{
InitializeComponent();
syntaxHighlighting = "C#";
DataContext = this;
}
Run Code Online (Sandbox Code Playgroud)
但语法高亮不会改变.我究竟做错了什么?对我的问题有更好的解决方案吗?
我在我的项目中使用了AvalonEdit,它基于WPF和MVVM.阅读这篇文章后,我创建了以下课程:
public class MvvmTextEditor : TextEditor, INotifyPropertyChanged
{
public static DependencyProperty DocumentTextProperty =
DependencyProperty.Register("DocumentText",
typeof(string), typeof(MvvmTextEditor),
new PropertyMetadata((obj, args) =>
{
MvvmTextEditor target = (MvvmTextEditor)obj;
target.DocumentText = (string)args.NewValue;
})
);
public string DocumentText
{
get { return base.Text; }
set { base.Text = value; }
}
protected override void OnTextChanged(EventArgs e)
{
RaisePropertyChanged("DocumentText");
base.OnTextChanged(e);
}
public event PropertyChangedEventHandler PropertyChanged;
public void RaisePropertyChanged(string info)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(info));
}
}
}
Run Code Online (Sandbox Code Playgroud)
并使用以下XAML来使用此控件:
<avalonedit:MvvmTextEditor x:Name="xmlMessage"> …Run Code Online (Sandbox Code Playgroud) 我正在使用,Avalon text editor并且键和音频位置没有因按键向上和按键而改变.任何人都可以建议我如何克服这个问题?
键右右导航的光标位置正确变化.
我还检查了键盘事件中插入符号的值,并且对于上下键按下它没有改变.
我需要在AvalonEdit中突出显示所有选定单词.我创建了一个HihglinghtingRule类的实例:
var rule = new HighlightingRule()
{
Regex = regex, //some regex for finding occurences
Color = new HighlightingColor {Background = new SimpleHighlightingBrush(Colors.Red)}
};
Run Code Online (Sandbox Code Playgroud)
我该怎么办?谢谢.
当我使用avalonedit开发自定义语言IDE时,我遇到了一个问题.我使用正则表达式检查语法,它按设计工作.但是,我想用波形文本标记显示语法错误.我在谷歌搜索,但解决方案已过时或不可行.有任何想法吗?谢谢你.
我试图在我的WPF应用程序中使用AvalonEdit作为XML文本编辑器.但是,它遇到无效语法时不会进行任何格式化(如波浪线).
我想知道是否可以使用AvalonEdit完成此类功能,或者是否有其他替代方法.谢谢!
我添加了一个从DocumentColorizingTransformer派生到TextEditor的LineTransformerClass:
TxtEditCodeViewer.TextArea.TextView.LineTransformers.Add(new ColorizeAvalonEdit());
Run Code Online (Sandbox Code Playgroud)
是否有任何编程方式在Linetransformer上调用失效?
我很容易认为,因为它被添加到textview,以下应该工作:
TxtEditCodeViewer.TextArea.TextView.InvalidateVisual();
TxtEditCodeViewer.TextArea.TextView.InvalidateArrange();
TxtEditCodeViewer.TextArea.TextView.InvalidateMeasure();
Run Code Online (Sandbox Code Playgroud)
但他们没有.为了以防万一,我也尝试了以下内容:
//TxtEditCodeViewer.TextArea.TextView.InvalidateVisual();
//TxtEditCodeViewer.TextArea.TextView.InvalidateArrange();
//TxtEditCodeViewer.TextArea.TextView.InvalidateMeasure();
//TxtEditCodeViewer.InvalidateVisual();
//TxtEditCodeViewer.InvalidateArrange();
//TxtEditCodeViewer.InvalidateMeasure();
//TxtEditCodeViewer.TextArea.InvalidateArrange();
//TxtEditCodeViewer.TextArea.InvalidateMeasure();
//TxtEditCodeViewer.TextArea.InvalidateVisual();
Run Code Online (Sandbox Code Playgroud) 我试图弄清楚如何更改 AvalonEdit CodeCompletion 窗口的样式。但是,我无法找出 xaml 样式目标/属性的正确组合来更改它。我想做的主要事情是去掉边框,但也许还需要一些额外的改变。
这是我尝试过的 xaml。这些都不会影响 UI。
xmlns:ae="clr-namespace:ICSharpCode.AvalonEdit.CodeCompletion;assembly=ICSharpCode.AvalonEdit"
<Style TargetType="{x:Type ae:CompletionWindow}">
<Setter Property="WindowStyle" Value="None" />
</Style>
<Style TargetType="{x:Type ae:CompletionWindowBase}">
<Setter Property="WindowStyle" Value="None" />
</Style>
<Style TargetType="{x:Type ae:CompletionListBox}">
<Setter Property="Background" Value="Red" />
</Style>
<Style TargetType="{x:Type ae:CompletionList}">
<Setter Property="Background" Value="Orange" />
</Style>
Run Code Online (Sandbox Code Playgroud) avalonedit ×10
c# ×7
wpf ×7
.net ×2
caret ×1
data-binding ×1
events ×1
highlighting ×1
invalidation ×1
search ×1
text-editor ×1
textedit ×1
xaml ×1
xml ×1