开发者

WPF Mdi from codeplex richtextbox issue

开发者 https://www.devze.com 2023-04-02 00:54 出处:网络
this question is only for those who use the MDI from Codeplex. I successfully implemented the mdi container and can add or remove child elements dinamically through my code.

this question is only for those who use the MDI from Codeplex.

I successfully implemented the mdi container and can add or remove child elements dinamically through my code.

My problem is that some of my custom controls (like UserControl) contain a few other controls (ex: TextBox, Buttons, ComboBox, etc), and every control works normally, EXCEPT for the RichTextBox!!!

The issue is that every time I input text in runtime mode, after each char input it automatically goes to another line.

Before you say that may be the way my custom control is built, be assured... it's not. I passed the control containing the richtextbox to another window and it worked normally.

Anyone has the same problem?? Or solution?? I know the codeplex version is still not fully finished but I'm hoping I'm the one d开发者_如何学JAVAoing something wrong...

Thanks


Found the issue. My RichTextBox Width Property was set to AUTO and for some reason (that is completely oblivious to me), it was what was causing the problem.

The solution is to give it a physical (a number rather than AUTO) value to it's Width property.

In my case, since my control has a TextBox just above the RichTextBox and they're supossed to be the same width, I've set my RichTextBox.Width = TextBox.ActualWidth. Note that I used ActualWidth and not width since the width property in my TextBox is also Auto, but the value returned by ActualWidth is a number.

Hope it helps someone :-)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号