Matthew Kruskamp
Matthew Kruskamp

Reputation: 1887

Dynamically resizing a window in Xaml

Is there a way for me to have the Window of my WPF application resize dynamically with the content? I tried setting the width and height to auto, but no go.

Upvotes: 11

Views: 8697

Answers (2)

user3456909
user3456909

Reputation: 81

Use a resizable control like Grid and put all the controls in Rows/Columns. Also set HorizontalAlignment to stretch for each control inside the Grid.

Upvotes: 1

Jobi Joy
Jobi Joy

Reputation: 50038

Set SizeToContent="WidthAndHeight" on the window and the window will dynamically resize based on its content size.

Upvotes: 18

Related Questions