avalonedit

How can I add this WPF control into my WinForm?

我与影子孤独终老i 提交于 2019-11-30 00:25:09
I know that I must use an ElementHost to display a WPF control in a WinForm, but as the WPF control is third party software and it only comes with an XML file and a DLL file. The control is AvalonEdit , I added both the ICSharpCode.AvalonEdit.xml and ICSharpCode.AvalonEdit.dll files to my project, and I went to Project -> Add Reference and added the DLL as a reference. Now I can access the ICSharpCode namespace in my code, all of the classes and methods are exposed, but from this point I am unsure how to actually use the control in my WinForm. I was expecting a WPF control to appear in the

Two Way Binding to AvalonEdit Document Text using MVVM

筅森魡賤 提交于 2019-11-29 20:41:33
I want to include an AvalonEdit TextEditor control into my MVVM application. The first thing I require is to be able to bind to the TextEditor.Text property so that I can display text. To do this I have followed and example that was given in Making AvalonEdit MVVM compatible . Now, I have implemented the following class using the accepted answer as a template public sealed class MvvmTextEditor : TextEditor, INotifyPropertyChanged { public static readonly DependencyProperty TextProperty = DependencyProperty.Register("Text", typeof(string), typeof(MvvmTextEditor), new PropertyMetadata((obj, args

AvalonEdit WPF TextEditor (SharpDevelop): How to highlight a specific range of text?

匆匆过客 提交于 2019-11-29 10:10:59
问题 The incredibly awesome AvalonEdit WPF TextEditor control seems to lack an important feature, or at least i can't figure it out. Given an offset and a length, highlight that portion in the TextDocument with a HighlightColor . Simple, right? Apprentely not. I've RTFM, and the documentation on "Syntax Highlighting" confused me even more. Someone else asked the same question in the SharpDevelop forums, and i'm afraid i can't make sense of Herr Grunwald's answer. Here's my attempt, using the

Two-way binding in AvalonEdit doesn't work

。_饼干妹妹 提交于 2019-11-29 04:12:17
I have used AvalonEdit in my project that is based on WPF and MVVM. After reading this post I created the following class: 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) {

Making AvalonEdit MVVM compatible

不想你离开。 提交于 2019-11-28 17:18:04
I'm trying to make Avalon MVVM compatible in my WPF application. From googling, I found out that AvalonEdit is not MVVM friendly and I need to export the state of AvalonEdit by making a class derived from TextEditor then adding the necessary dependency properties. I'm afraid that I'm quite lost in Herr Grunwald's answer here : If you really need to export the state of the editor using MVVM, then I suggest you create a class deriving from TextEditor which adds the necessary dependency properties and synchronizes them with the actual properties in AvalonEdit. Does anyone have an example or have

Two Way Binding to AvalonEdit Document Text using MVVM

孤街浪徒 提交于 2019-11-28 16:29:09
问题 I want to include an AvalonEdit TextEditor control into my MVVM application. The first thing I require is to be able to bind to the TextEditor.Text property so that I can display text. To do this I have followed and example that was given in Making AvalonEdit MVVM compatible. Now, I have implemented the following class using the accepted answer as a template public sealed class MvvmTextEditor : TextEditor, INotifyPropertyChanged { public static readonly DependencyProperty TextProperty =

Two-way binding in AvalonEdit doesn't work

放肆的年华 提交于 2019-11-27 18:08:07
问题 I have used AvalonEdit in my project that is based on WPF and MVVM. After reading this post I created the following class: 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

Making AvalonEdit MVVM compatible

怎甘沉沦 提交于 2019-11-27 10:35:26
问题 I'm trying to make Avalon MVVM compatible in my WPF application. From googling, I found out that AvalonEdit is not MVVM friendly and I need to export the state of AvalonEdit by making a class derived from TextEditor then adding the necessary dependency properties. I'm afraid that I'm quite lost in Herr Grunwald's answer here: If you really need to export the state of the editor using MVVM, then I suggest you create a class deriving from TextEditor which adds the necessary dependency