dotnet / dotnet/winforms

RichTextBox.ScrollBars breaks the binding in a way that TextBox.ScrollBars doesn't

Open
#3,840 1 comment 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
area-Binding area-controls-RichEdit
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

**.NET Version:**
.net framework 4.8 and 4.6, as far as I can test. Never test on .Net core.

**Summary:**

I found that if I set the `RichTextBox.ScrollBars` after I assign the binding, then the binding to `Visible` property will be broken.

On the other hand, if I set the `TextBox.ScrollBars` after I assign the binding, then the binding to `Visible` property will still remain intact.

**Repo**

Please run [**the richtextbox.zip**](https://github.com/dotnet/winforms/files/5174254/richtextbox.zip) to see the problem.

**Expectation:**

Note that if I set `richTextBox1.ScrollBars = RichTextBoxScrollBars.None`; after `BindVM` method in `Form1_Load()`, then as I key in some values or erase some values in `richTextBox1`, then the `richTextBox1` visibility will _not_ be updated, but the `textbox` visibility will be updated.

But the same problem won't occur if I set `textBox3.ScrollBars = ScrollBars.None`;

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.