Class StyleManager
Definition
- Assembly:
- Tizen.NUI.dll
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.
public class StyleManager : BaseHandle, IDisposable
- Inheritance
- Implements
-
System.IDisposable
Constructors
View SourceStyleManager()
Creates a StyleManager handle.
This can be initialized with StyleManager::Get().
Declaration
public StyleManager()
Methods
View SourceAddConstant(string, PropertyValue)
Sets a constant for use when building styles.
Declaration
public void AddConstant(string key, PropertyValue value)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the constant. |
PropertyValue | value | The value of the constant. |
ApplyDefaultTheme()
Applies the default Toolkit theme.
Declaration
public void ApplyDefaultTheme()
ApplyStyle(View, string, string)
Applies the specified style to the control.
Declaration
public void ApplyStyle(View control, string jsonFileName, string styleName)
Parameters
Type | Name | Description |
---|---|---|
View | control | The control to which to apply the style. |
string | jsonFileName | The name of the JSON style file to apply. |
string | styleName | The name of the style within the JSON file to apply. |
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
public void ApplyTheme(string themeFile)
Parameters
Type | Name | Description |
---|---|---|
string | themeFile | A relative path is specified for style theme. |
Get()
Gets the singleton of StyleManager object.
Declaration
public static StyleManager Get()
Returns
Type | Description |
---|---|
StyleManager | A handle to the StyleManager control. |
GetConstant(string, PropertyValue)
Returns the style constant set for a specific key.
Declaration
public bool GetConstant(string key, PropertyValue valueOut)
Parameters
Type | Name | Description |
---|---|---|
string | key | The key of the constant. |
PropertyValue | valueOut | The value of the constant if it exists. |
Returns
Type | Description |
---|---|
bool |
Events
View SourceStyleChanged
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
public event EventHandler<StyleManager.StyleChangedEventArgs> StyleChanged
Event Type
Type | Description |
---|---|
System.EventHandler<TEventArgs><StyleManager.StyleChangedEventArgs> |