© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
5 replies
mario12136

❔ How to use a readonly property for binding [AvalonEdit]?

Hello,
I have created a behavior for AvalonEdit following the accepted answer here https://stackoverflow.com/questions/18964176/two-way-binding-to-avalonedit-document-text-using-mvvm.

I want to have an instance of AvalonEdit that is readonly and I have a property in my viewmodel that looks liks this

public string SavedText => _document.Text;
public string SavedText => _document.Text;

I notify this property of change in one of my methods and it updates but the text of the readonly editor doesn't. The binding is OneWay and I have tried for example making a setter that does nothing for the property and the problem is solved for some reason. Note that whenever I call
OnPropertyChanged(nameof(SavedText))
OnPropertyChanged(nameof(SavedText))
the property's value is updated but the callback function in the behavior is not called.

I want a readonly property (doesn't make sense for it not to be) and a readonly editor and when the property is notified of changed the editor's text updates as well.
Stack Overflow
Two Way Binding to AvalonEdit Document Text using MVVM
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...
Two Way Binding to AvalonEdit Document Text using MVVM
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ How to create a bindable Text property for AvalonEdit?
C#CC# / help
3y ago
✅ Return readonly property
C#CC# / help
2y ago
EntityFramework Property Binding
C#CC# / help
3y ago
❔ How to create commands for my subclassed AvalonEdit control?
C#CC# / help
3y ago