Share via


Using ColorFills

A ColorFill view item creates rectangles of solid color—for example, to add a background to another view item. The ColorFill is sized to the content, so if it does not have any child elements and a minimum size or padding are not set, the ColorFill will not be displayed.

The following example shows how ColorFill layouts are displayed with child elements, padding, and a minimum size.

An example of a ColorFill view item.

    <Content>
      <Panel>
        <Layout>
          <FlowLayout Orientation="Horizontal" ItemAlignment="Center" Spacing="20,20" />
        </Layout>
        
        <Children>
          <ColorFill Content="Red" MinimumSize="50,50" Padding="20,20,20,20"  />
          <ColorFill Content="Orange" MinimumSize="50,50" />
          <ColorFill Content="Yellow" Layout="HorizontalFlow">
            <Children>
              <Text Content="ColorFills!" />
            </Children>
          </ColorFill>
          <ColorFill Content="Blue" MinimumSize="50,50" />
          <ColorFill Content="Green" MinimumSize="50,50" Padding="20,20,20,20" />
        </Children>
        
      </Panel>
    </Content>

Sample Explorer

  • View Items – ColorFill > all samples

See Also