Enumerations #
Name | Values |
---|---|
States | Default Hover Pressed Visited Active Target Focus FocusWithin FocusVisible Enabled Disabled |
Constants #
This class exposes no constants.
Events #
This class exposes no events.
Shared Methods #
Definition | Parameters | Return Type | Description |
---|---|---|---|
Create | inSession as WebSession | GraffitiStyle | Creates a new instance of a GraffitiStyle object with the specified parameters. withName should be unique for each use case. If you wish to reuse a WebStyle you have previously created for the specified WebSession, you simply supply the same withName parameter. |
withName as String | |||
withContent as String | |||
withState as GraffitiStyle.States = GraffitiStyle.States.Default | |||
DestroyInstance | Name as String | None | Destroys a GraffitiStyle instance and removes its CSS from the browser’s DOM. |
SessionID as String | |||
GetInstance | inSession as WebSession | GraffitiStyle | Will return the specified style if it exists, or create a new instance matching the passed parameters. |
withName as String | |||
state as GraffitiStyle.States = GraffitiStyle.States.Default |
Methods #
Definition | Parameters | Return Type | Description |
---|---|---|---|
AddTo | controlObject as WebControl | None | Applies the GraffitiStyle’s CSS class name to the specified control. |
AddTo | controlSelector as String | None | Applies the GraffitiStyle’s CSS class name to any object whose DOM selector matches the supplied value. |
Operator_Add | style as GraffitiStyle | GraffitiStyle | Returns a new GraffitiStyle that combines the content of the current style and the style supplied in the parameter. |
RemoveFrom | controlObject as WebControl | None | Removes the GraffitiStyle’s CSS class name from the specified control. |
RemoveFrom | controlSelector as String | None | Removes the GraffitiStyle’s CSS class name from any object whose DOM selector matches the supplied value. |
Properties #
Name | Type | Default Value | Description |
---|---|---|---|
Content | String | “” | The CSS content of the GraffitiStyle instance. |
IsClass | Boolean | True | When False, any arbitrary CSS selector may be passed in the Create method’s withName parameter to modify any portion of the DOM, including pseudo-selectors. |
Name | String | “” | The class name of this object. This is what will be used in the browser, so be careful what names you choose as there is the potential for undesirable results. |
State | States | States.Default | The browser object state under which this GraffitiStyle is applied. For example, Hover. |
Notes #
About Style Properties #
All GraffitiSuite controls have a BaseStyle property, but it is unused in some cases. This property is meant to apply to the background of the control, but doesn’t make sense in all scenarios. Typically, those control parts that logically may require styles have Style* properties that can be modified with a GraffitiStyle.
If you see a control whose BaseStyle property does not have an effect and you believe it should, please open a support ticket.
Ensuring Effects #
Due to some instances where default CSS takes precedence over later defined styles (such as in GraffitiAccordion), you may need to add the !important
attribute to your CSSvalues. For example:
Var titleStyle As GraffitiStyle = GraffitiStyle.Create( Session, "AccordionHeader", "background: rgb(0,255,0) !important" )
Examples #
Creating a New GraffitiStyle #
var gridRowEven as GraffitiStyle = GraffitiStyle.Create( Session, "gridRowEven", "background:rgba(0, 0, 0, 0.2);color:#00f" )
Applying a GraffitiStyle to a GraffitiSuite Control #
All GraffitiSuite components have a BaseStyle property which can be used for applying GraffitiStyles.
var myGridStyle as GraffitiStyle = GraffitiStyle.Create( Session, "myGridStyle", "background:rgba(0, 0, 0, 0.2);color:#00f" )
GraffitiGrid1.BaseStyle = myGridStyle
Applying a GraffitiStyle to a Default Xojo Control #
var myPaginationStyle as GraffitiStyle = GraffitiStyle.Create( Session, "myPaginationStyle", "background:rgba(0, 0, 0, 0.2);color:#00f" )
myPaginationStyle.AddTo(WebPagination1)
Applying a GraffitiStyle to part of a Default Xojo Control #
var myPaginationStyleActive as GraffitiStyle = GraffitiStyle.Create( Session, "myPaginationStyleActive", "background:rgba(0, 0, 0, 0.2);color:#00f" )
myPaginationStyleActive.AddTo("#" + WebPagination1.ControlID + " li.page-item.active")
Retrieve an Instance of a WebStyle #
var styleOne as GraffitiStyle = GraffitiStyle.GetInstance( "tabStyleOne", Session.Identifier, GraffitiStyle.States.Default )