Resize an object automatically at runtime
When you resize an element, you might not get the result you expect if the properties under Layout in the Properties panel are not set correctly. The properties that affect the size of an element are the width, height, alignment, and margin properties. For example, if you want an element to resize automatically at runtime when the size of the application window changes, you must set the Width and Height to Auto, select the HorizontalAlignment and VerticalAlignment that you want, and then adjust the size by using the Margin properties.
On the artboard or in the ObjectsandTimeline panel, click the element that you want to resize to select it.
Under Layout in the Properties panel, click Set to Auto . Alternatively, click Advanced property options next to the Width and Height property, and then click Auto.
When you set the width and height of an element to Auto, your element might reduce in size until you adjust the margin properties to pull the sides of the element toward the edges of the containing element.
The next properties that are listed under Width and Height depend on the type of layout panel that contains your element. For example, if the parent element is a Grid layout panel, you will see Row, RowSpan, Column, and ColumnSpan properties. If the parent element is a Canvas, you will see Left and Top properties. You can set these properties to determine the position of your element in the layout panel.
If the parent element is a StackPanel layout panel, the child elements will not have extra properties under Width and Height because the layout is determined by the Orientation property of the StackPanel, and all child elements are stacked in the order provided in the Objects and Timeline panel.
Still under Layout in the Properties panel, set the HorizontalAlignment and VerticalAlignment properties by clicking one of the following buttons:
Finally, set the Margin properties to determine how far from the sides of the containing element to display your element.
These margin values will stay static. In other words, if the size of your application window is reduced far enough, your element will disappear completely. You can prevent your element from disappearing by setting the minimum width and minimum height properties. Under Layout in the Properties panel, click Show advanced properties , and then enter values in the MinWidth and MinHeight properties.