Tuesday, March 8, 2011

SizeToContent Property (Window)

The SizeToContent property defined by the Window class causes the window to adjust itself to be just as big as the size of its content. If you're still using the same LinearGradientBrush for foreground and background, you won't be able to see the text. You set the SizeToContent property to a member of the SizeToContent enumeration: Manual (which is the default), Width, Height, or WidthAndHeight. With the latter three, the window adjusts its width, height, or both the size of its contents. This is a very handy property that you'll often use when designing dialog boxes or other forms. When setting a window to the size of its content, you'll often want to suppress the sizing border with the following:

ResizeMode = ResizeMode.CanMinimize;




OR


ResizeMode = ResizeMode.NoResize;



No comments:

Post a Comment