GraffitiStyle

View Categories

Enumerations #

NameValues
StatesDefault
Hover
Pressed
Visited
Active
Target
Focus
FocusWithin
FocusVisible

Constants #

This class exposes no constants.

Events #

This class exposes no events.

Shared Methods #

DefinitionParametersReturn TypeDescription
CreateinSession as WebSessionGraffitiStyleCreates 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
DestroyInstanceName as StringNoneDestroys a GraffitiStyle instance and removes its CSS from the browser’s DOM.
SessionID as String
GetInstanceinSession as WebSessionGraffitiStyleWill 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 #

DefinitionParametersReturn TypeDescription
AddTocontrolObject as WebControlNoneApplies the GraffitiStyle’s CSS class name to the specified control.
AddTocontrolSelector as StringNoneApplies the GraffitiStyle’s CSS class name to any object whose DOM selector matches the supplied value.
Operator_Addstyle as GraffitiStyleGraffitiStyleReturns a new GraffitiStyle that combines the content of the current style and the style supplied in the parameter.
RemoveFromcontrolObject as WebControlNoneRemoves the GraffitiStyle’s CSS class name from the specified control.
RemoveFromcontrolSelector as StringNoneRemoves the GraffitiStyle’s CSS class name from any object whose DOM selector matches the supplied value.

Properties #

NameTypeDefault ValueDescription
ContentString“”The CSS content of the GraffitiStyle instance.
IsClassBooleanTrueWhen 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.
NameString“”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.
StateStatesStates.DefaultThe 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 )