Class Theme

Definition

Namespace:
Tizen.NUI
Assembly:
Tizen.NUI.dll
API Level:
9

Basically, the Theme is a dictionary of ViewStyles that can decorate NUI Views. Each ViewStyle item is identified by a string key that can be matched the StyleName.

The main purpose of providing theme is to separate style details from the structure. Managing style separately makes it easier to customize the look of application by user context. Also since a theme can be created from xaml file, it can be treated as a resource. This enables sharing styles with other applications.

C#
Copy
public class Theme : BindableObject, INotifyPropertyChanged, IDynamicResourceHandler, IResourcesProvider
Inheritance
System.Object
Theme
Implements
System.ComponentModel.INotifyPropertyChanged

Constructors

View Source

Theme()

Create an empty theme.

Declaration
C#
Copy
public Theme()
API Level: 9
View Source

Theme(String)

Create a new theme from the xaml file.

Declaration
C#
Copy
public Theme(string xamlFile)
Parameters
Type Name Description
System.String xamlFile

An absolute path to the xaml file.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the given xamlFile is null or empty string.

IOException

Thrown when there are file IO problems.

Tizen.NUI.Xaml.XamlParseException

Thrown when the content of the xaml file is not valid xaml form.

API Level: 9

Properties

View Source

Id

The string key to identify the Theme.

Declaration
C#
Copy
public string Id { get; set; }
Property Value
Type Description
System.String
API Level: 9
View Source

Version

The version of the Theme.

Declaration
C#
Copy
public string Version { get; set; }
Property Value
Type Description
System.String
API Level: 9

Methods

View Source

AddStyle(String, ViewStyle)

Adds the specified style name and value to the theme. This replace existing value if the theme already has a style with given name.

Declaration
C#
Copy
public void AddStyle(string styleName, ViewStyle value)
Parameters
Type Name Description
System.String styleName

The style name to add.

ViewStyle value

The style instance to add.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the given styleName is null.

API Level: 9
View Source

Clone()

Declaration
C#
Copy
public object Clone()
Returns
Type Description
System.Object
API Level: 9
View Source

GetStyle(String)

Gets a style of given style name.

Declaration
C#
Copy
public ViewStyle GetStyle(string styleName)
Parameters
Type Name Description
System.String styleName

The string key to find a ViewStyle.

Returns
Type Description
ViewStyle

Found style instance if the style name has been found, otherwise null.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the given styleName is null.

API Level: 9
View Source

GetStyle(Type)

Gets a style of given view type.

Declaration
C#
Copy
public ViewStyle GetStyle(Type viewType)
Parameters
Type Name Description
Type viewType

The type of View.

Returns
Type Description
ViewStyle

Found style instance if the view type is found, otherwise null.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the given viewType is null.

API Level: 9
View Source

Merge(Theme)

Merge other theme into this.

Declaration
C#
Copy
public void Merge(Theme theme)
Parameters
Type Name Description
Theme theme

The theme to be merged with this theme.

API Level: 9

Implements

System.ComponentModel.INotifyPropertyChanged