Class StyleManager

Definition

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

The StyleManager informs applications of the system theme change, and supports application theme change at runtime.
Applies various styles to controls using the properties system.
On theme change, it automatically updates all controls, then raises a event to inform the application.
If the application wants to customize the theme, RequestThemeChange needs to be called.
It provides the path to the application resource root folder, from there the filename can be specified along with any subfolders, for example, Images, Models, etc.

C#
Copy
public class StyleManager : BaseHandle, INotifyPropertyChanged, IDynamicResourceHandler, IElement, INameScope, IElementController, IDisposable
Inheritance
System.Object
Tizen.NUI.Binding.BindableObject
Tizen.NUI.Binding.Element
StyleManager
Implements
System.ComponentModel.INotifyPropertyChanged
System.IDisposable

Constructors

View Source

StyleManager()

Creates a StyleManager handle.
This can be initialized with StyleManager::Get().

Declaration
C#
Copy
public StyleManager()
API Level: 3

Properties

View Source

Instance

Gets the singleton of the StyleManager object.

Declaration
C#
Copy
public static StyleManager Instance { get; }
Property Value
Type Description
StyleManager
API Level: 5

Methods

View Source

AddConstant(String, PropertyValue)

Sets a constant for use when building styles.

Declaration
C#
Copy
public void AddConstant(string key, PropertyValue value)
Parameters
Type Name Description
System.String key

The key of the constant.

PropertyValue value

The value of the constant.

API Level: 3
View Source

ApplyDefaultTheme()

Applies the default Toolkit theme.

Declaration
C#
Copy
public void ApplyDefaultTheme()
API Level: 3
View Source

ApplyStyle(View, String, String)

Applies the specified style to the control.

Declaration
C#
Copy
public void ApplyStyle(View control, string jsonFileName, string styleName)
Parameters
Type Name Description
View control

The control to which to apply the style.

System.String jsonFileName

The name of the JSON style file to apply.

System.String styleName

The name of the style within the JSON file to apply.

API Level: 3
View Source

ApplyTheme(String)

Applies a new theme to the application.
This will be merged on the top of the default Toolkit theme.
If the application theme file doesn't style all controls that the application uses, then the default Toolkit theme will be used instead for those controls.

Declaration
C#
Copy
public void ApplyTheme(string themeFile)
Parameters
Type Name Description
System.String themeFile

A relative path is specified for style theme.

API Level: 3
View Source

Get()

Gets the singleton of StyleManager object.

Declaration
C#
Copy
public static StyleManager Get()
Returns
Type Description
StyleManager

A handle to the StyleManager control.

API Level: 3
View Source

GetConstant(String, PropertyValue)

Returns the style constant set for a specific key.

Declaration
C#
Copy
public bool GetConstant(string key, PropertyValue valueOut)
Parameters
Type Name Description
System.String key

The key of the constant.

PropertyValue valueOut

The value of the constant if it exists.

Returns
Type Description
System.Boolean
API Level: 3

Events

View Source

StyleChanged

An event for the StyleChanged signal which can be used to subscribe or unsubscribe the event handler provided by the user.
The StyleChanged signal is emitted after the style (for example, theme or font change) has changed and the controls have been informed.

Declaration
C#
Copy
public event EventHandler<StyleManager.StyleChangedEventArgs> StyleChanged
Event Type
Type Description
System.EventHandler<StyleManager.StyleChangedEventArgs>
API Level: 3

Implements

System.ComponentModel.INotifyPropertyChanged
System.IDisposable