icsharpcode / AvalonEdit

The WPF-based text editor component used in SharpDevelop
http://avalonedit.net/
MIT License
1.85k stars 469 forks source link

No Distinction Between Height and MaxHeight #394

Open chaojian-zhang opened 1 year ago

chaojian-zhang commented 1 year ago

Scenario: Want TextEdit to automatically grow in height until it hits a maximum height, then it should show vertical scroll bar instead of keep growing height.

Observation: Absolutely not possible.

Expectation: If I were using a regular WPF TextBox, all I need to do is to set a MaxHeight and VerticaScrollBarVisibility as Auto.

Issue: Setting either Height or MaxHeight for TextEdit causes the control to have a fixed height.

chaojian-zhang commented 1 year ago

A workaround for this problem is to wrap the Text Editor inside a Border, and set MaxHeight for the Border instead.

ApokalmiX commented 1 year ago

Even with your workaround I still have this behavior. It seems to come from the ShowLineNumbers property because when this function is disabled, the control behaves normally.