.NET Framework 4.6 and 4.5
Gets or sets a value that indicates whether a window will automatically size itself to fit the size of its content.
XMLNS for XAML:
member SizeToContent : SizeToContent with get, set
< object SizeToContent = " SizeToContent " ... />
is set to SizeToContent , setting either WidthAndHeight or Height has no effect; both properties can be set, but the values they are set with are not applied to the window. Width
is set to SizeToContent , setting Height does not change the height of the window. Height
is set to SizeToContent , setting Width does not change the width of the window. Width
has a value other than SizeToContent : Manual is automatically set to SizeToContent if a user resizes the window by using the resize grip or dragging the border. Manual
If the size of the content changes in a way that causes the window to resize itself,
is raised. SizeChanged
If a window is transparent (see
), you should consider setting AllowsTransparency to SizeToContent to ensure the window is no larger than its visible content. WidthAndHeight
You cannot set or get this property when a window is hosted in a browser.
The following example shows how to set the
property in code to specify how a window resizes to fit its content. SizeToContent
No code example is currently available or this language may not be supported.
Supported in: 4.6, 4.5, 4, 3.5, 3.0
.NET Framework Client Profile
Supported in: 4, 3.5 SP1
( 1500 characters remaining)
Thank you for your feedback