Export (0) Print
Expand All

Setting Minimum and Maximum Sizes

The MinimumSize and MaximumSize properties are available for all view items so that you can force the layout to meet certain sizing requirements for height and width (a zero value for either dimension indicates that there is no restriction on it). However, it is rarely necessary to need both a minimum and maximum size. When working with text that you intend to localize, use care when setting these properties to allow for varying word lengths.

It is possible to over-restrict these values. If the restrictions don't make sense (for example, the maximum size is smaller than the minimum size), or if they cannot be met, the view item will not be displayed. In the example below, the maximum size of the containing parent element is smaller than a child element's minimum size. The result is the child element cannot be displayed.

  <UI Name="OverConstrainedSizes">
    <Content>
      <ColorFill Content="SlateGray" MaximumSize="200,200" Layout="Center" >
        <Children>

          <ColorFill Content="Crimson" MinimumSize="100,100" />

          <!-- This child cannot be displayed. -->
          <ColorFill Content="Violet" MinimumSize="300,300" />

        </Children>
      </ColorFill>
    </Content>
  </UI>

Sample Explorer

  • Layout > MinimumSize andMaximumSize

See Also

Show:
© 2014 Microsoft