The layout tag is used to define the layout for one widget. There are two attributes available. The name attribute which is used to identify the layout. It needs to be unique. The other attribute is optional and called Inherits. With this attribute you are able to inherit from another layout. All the definitions of the inherited layout are used to initialize your new layout and after that the properties of the layout which is inheriting are loaded. Properties which are defined in the base layout and the inherited layout are overwritten by the inherited ones.

A base layout looks something like that:

  <Layout Name="Widget">
    <ForeColor Color="{R:0 G:0 B:0 A:255}" />
    <BackColor Color="{R:255 G:255 B:255 A:255}" />

This defines the ForeColor and the BackColor as base widget layout. All other widgets are inheriting this layout.

Here's a example:

  <Layout Name="MyWidget" Inherits="Widget">
    <ForeColor Color="{R:255 G:0 B:0 A:255}" />

When the "MyWidget" layout is loaded all values of the inherited "Widget" layout are loaded. This initializes the ForeColor with black and the back color with white. After that the properties of the "MyWidget" layout are loaded. Because there's a ForeColor property defined, the inherited value is overwritten and the final ForeColor becomes red.

The optional sub elements of Layout are ForeColor, BackColor, MinimumSize, MaximumSize, DefaultSize and State.

Last edited May 4, 2011 at 6:23 PM by Glatzemann, version 1


No comments yet.