Table of Contents

Class CssData

Namespace
TheArtOfDev.HtmlRenderer.Core
Assembly
StockSharp.Xaml.dll

Holds parsed stylesheet css blocks arranged by media and classes.
CssBlock

public sealed class CssData
Inheritance
CssData
Inherited Members
Extension Methods

Remarks

To learn more about CSS blocks visit CSS spec: http://www.w3.org/TR/CSS21/syndata.html#block

Methods

AddCssBlock(string, CssBlock)

Add the given css block to the css data, merging to existing block if required.

public void AddCssBlock(string media, CssBlock cssBlock)

Parameters

media string

the media type to add the CSS to

cssBlock CssBlock

the css block to add

Remarks

If there is no css blocks for the same class it will be added to data collection.
If there is already css blocks for the same class it will check for each existing block if the hierarchical selectors match (or not exists). if do the two css blocks will be merged into one where the new block properties overwrite existing if needed. if the new block doesn't mach any existing it will be added either to the beginning of the list if it has no hierarchical selectors or at the end.
Css block without hierarchical selectors must be added to the beginning of the list so more specific block can overwrite it when the style is applied.

Clone()

Create deep copy of the css data with cloned css blocks.

public CssData Clone()

Returns

CssData

cloned object

Combine(CssData)

Combine this CSS data blocks with other CSS blocks for each media.
Merge blocks if exists in both.

public void Combine(CssData other)

Parameters

other CssData

the CSS data to combine with

ContainsCssBlock(string, string)

Check if there are css blocks for the given class selector.

public bool ContainsCssBlock(string className, string media = "all")

Parameters

className string

the class selector to check for css blocks by

media string

optional: the css media type (default - all)

Returns

bool

true - has css blocks for the class, false - otherwise

GetCssBlock(string, string)

Get collection of css blocks for the requested class selector.
the className can be: class name, html element name, html element and class name (elm.class), hash tag with element id (#id).
returned all the blocks that word on the requested class selector, it can contain simple selector or hierarchy selector.

public IEnumerable<CssBlock> GetCssBlock(string className, string media = "all")

Parameters

className string

the class selector to get css blocks by

media string

optional: the css media type (default - all)

Returns

IEnumerable<CssBlock>

collection of css blocks, empty collection if no blocks exists (never null)

Parse(RAdapter, string, bool)

Parse the given stylesheet to CssData object.
If combineWithDefault is true the parsed css blocks are added to the default css data (as defined by W3), merged if class name already exists. If false only the data in the given stylesheet is returned.

public static CssData Parse(RAdapter adapter, string stylesheet, bool combineWithDefault = true)

Parameters

adapter RAdapter

Platform adapter

stylesheet string

the stylesheet source to parse

combineWithDefault bool

true - combine the parsed css data with default css data, false - return only the parsed css data

Returns

CssData

the parsed css data