Click or drag to resize
DigitalRuneTheme Class
Represents a UI theme that defines the properties and visual appearance of UI controls.
Inheritance Hierarchy
SystemObject
  DigitalRune.Game.UI.RenderingTheme

Namespace: DigitalRune.Game.UI.Rendering
Assembly: DigitalRune.Game.UI (in DigitalRune.Game.UI.dll) Version: 1.8.0.0 (1.8.0.14553)
Syntax
public class Theme

The Theme type exposes the following members.

Constructors
  NameDescription
Public methodTheme
Initializes a new instance of the Theme class.
Top
Methods
  NameDescription
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Properties
  NameDescription
Public propertyContent
Gets or sets the content manager.
Public propertyCursors
Gets the cursor definitions.
Public propertyFonts
Gets the fonts definitions.
Public propertyStyles
Gets the styles of the controls.
Public propertyTextures
Gets the textures.
Top
Remarks

A Theme can be built at runtime, but usually a theme is defined in an XML files that is processed in the XNA Content Pipeline and loaded via the XNA ContentManager.

The XML file specifies mouse cursors (only used in Windows), fonts, a texture and styles. The texture is a texture atlas containing all images that are necessary to render the controls. The styles define property values and the visual appearance of UI controls.

XML Format: See the example themes to learn how the XML file is structured. Colors, rectangles and 4D vectors are specified using 4 float values separated with commas, semicolons and/or spaces, for example "100,200,300,400". (Colors are defined as "red,green,blue,alpha", rectangles are defined as "x,y,width,height", borders/margins/paddings are defined as "left,top,right,bottom".)

Processing and Loading: To load a theme add the XML file to an XNA Content Project. The content project needs to reference the following DigitalRune content pipeline assemblies: "DigitalRune.Mathematics.Content.Pipeline.dll" and DigitalRune.Game.UI.Content.Pipeline.dll". Once the assembly references are added, set the Content Importer and the Content Processor of the XML file to "UI Theme - DigitalRune". The theme and all related files are then automatically built together with the content project.

At runtime the theme can be loaded using the game's ContentManager.

C#
Theme theme = Content.Load<Theme>("BlendBlue");

See Also