Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Setting TextBox.Width="*" via Code

Does anyone know how to set the TextBox.Width property to fill up the remainder of the parent container in code? In Xaml, I would simply set the Width property to *, but I can't figure out how to do this in code.

Thanks, Roy

like image 816
LPCRoy Avatar asked Dec 22 '22 11:12

LPCRoy


1 Answers

Are you looking for

HorizontalAlignment="Stretch"

Related answers:

WPF - setting HorizontalAlignment= Stretch to Textbox in StackPanel

HorizontalAlignment=Stretch, MaxWidth, and Left aligned at the same time?

like image 66
John T Avatar answered Jan 07 '23 13:01

John T