Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get WPF control height when it is set 'Auto'

I need get a WPF control height for calculate my next control margin top, but when I try get control height with textbox1.height, this is return 'Auto' and not numbers

What can I do for get control height, when it is set 'Auto'?

like image 986
Lai32290 Avatar asked Jun 25 '13 22:06

Lai32290


1 Answers

You should try this:

textBox1.ActualHeight

Remarks (by @Viv)

just make sure when you query for textBox1.ActualHeight, you do it once the control is Loaded. You're going to get 0.0 if you check ActualHeight before it's setup properly

like image 80
Wojciech Kulik Avatar answered Nov 14 '22 23:11

Wojciech Kulik