This is a migrated thread and some comments may be shown as answers.

Custom UserControl with fixed height(RadTextBox)

2 Answers 65 Views
TextBox
This is a migrated thread and some comments may be shown as answers.
Leandro
Top achievements
Rank 1
Leandro asked on 01 Sep 2018, 03:43 PM

 Hi there, I've searched internet for info for a long time but I couldn't get much answers, this why I'm asking here.

I have a simple UserControl with 2 radtextbox inside, one with dock left and other with dock fill.

What I wanna do is the same u do with Textbox height. Example: if u change the Textbox Font or ThemeName it's height will be resized.

This is exactly what I want to do, change my UserControl height to be exactly the same TextBox height when I change Font or ThemeName.

I've already tried:  

-> override void SetBoundsCore();

-> inherit ControlDesigner to override SelectionRules.

-> overriding Size property do half work, because the UC keeps reseting location to 0,0 when used, every build 

And, of course I'm setting those TextBox Font and Theme when change it on UserControl.

And it should work the same way on the designer.

Sorry for bad english. And hope u could understand what I'm trying to achieve.

 

2 Answers, 1 is accepted

Sort by
0
Leandro
Top achievements
Rank 1
answered on 01 Sep 2018, 04:33 PM
OMG, just delete this post, I found what was wrong, I could handle it just by overriding Size property and subscribing to SizeChanged of the RadTextBox. The problem is when I was setting ThemeName of UC I was calling UpdateBounds() ... removing it solve, that was an older code and was working with override void SetBoundsCore()
0
Hristo
Telerik team
answered on 03 Sep 2018, 06:07 AM
Hello Leandro,

I am glad that you have found a suitable solution for your actual scenario. Thank you also for updating the thread, the new information you have shared might also help the community.

Let me know if you have other questions.

Regards,
Hristo
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
TextBox
Asked by
Leandro
Top achievements
Rank 1
Answers by
Leandro
Top achievements
Rank 1
Hristo
Telerik team
Share this question
or