Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8257263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:08:23+00:00 2026-06-08T02:08:23+00:00

I know you can disable input altogether if you handle the PreviewKeyDown event of

  • 0

I know you can disable input altogether if you handle the PreviewKeyDown event of the editor and then set the e.Handled of the KeyEventArgs to true.

However, I’m trying to figure out how to prevent the document text from updating after the text is modified. I want to handle the Document.Changing event, like so:

textEditor.Document.Changing += Document_Changing;

where textEditor is my AvalonEdit editor. I want to retrieve the text that is being modified, in the function

private void Document_Changing(object sender, DocumentChangeEventArgs e)

and then do some computation based on it. However, I do not want the text to be updated in the editor before it’s being processed. I’m doing some async processing in the Document_Changing, and I fire another event when it’s finished, and only then I want it to update. I don’t want to disable just visual updating, but updating the document altogether.

So is there a way to disable this update, similar to how you can prevent input when handling keyboard-related events?

Thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T02:08:26+00:00Added an answer on June 8, 2026 at 2:08 am

    You can use the textEditor.TextArea.TextEntering event to prevent the user from typing.
    However that event only is used for typing; other operations (e.g. Cut/Paste/Drag’n’Drop) currently do not cause any editor events (only the document event, but at that point it’s too late to abort).

    Another option is to implement IReadOnlySectionProvider to mark the text as read-only. This works for both text input and clipboard operations, and even disables the ‘Paste’ menu command when the caret is inside a read-only section.
    The TextSegmentReadOnlySectionProvider class provides a useful default implementation for the interface.

    For turning the whole document read-only, simply set textEditor.IsReadOnly = true;.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Actually i can call this code $(:input).attr(disabled,true); //Disable all input fields to disable all
I know you can use -fno-objc-arc flag to disable ARC for files that NOT
You can know if the event stack is empty calling the gtk.events_pending() method, but
I know you can not set a key value dynamically, but what about the
How can I disable an input-field with jQuery using GM if the url contains
I have this jQuery line: jQuery(input[name=secondname10]).removeAttr(disabled).val(); I'd like to know how can I make
I want to know can we have a JPanel with a Layout other than
This is something I know can be done somehow , because I've done it
I need to know can we add image in TextArea through StyleableTextField htmlText because
I have a query that I know can be done using a subselect, but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.