Here is the code for Textbox available in my window(form1.xaml),My requirement is when i am resizing my window i want to resize the textbox width also, How can i able to achieve
In WPF you typically place TextBox
control within layout Grid
control and set the ColumnDefinition Width
property of that Grid cell to some relative value "*", so it will resize with the Window. Do NOT use a fixed Width="500" as per your sample: also, remove that "HorizontalAlignment="Left"
(the default value is HorizontalAlignment="Stretch"
, so you can just omit it to simplify your XAML). See the following sample code snippet:
Note: The same technique could be applied to a vertical "Height" property in case you need to make it also resizable.
Hope this will help. Best regards,