Search Results for

    Show / Hide Table of Contents

    Class HexValueAttribute

    Inheritance
    System.Object
    HexValueAttribute
    Namespace: IronWord.Models.Enums
    Assembly: IronWord.dll
    Syntax
    public class HexValueAttribute : Attribute

    HexValueAttribute is the annotation that pins a hexadecimal string to an enum member, so a named value can also carry its raw hex form. It decorates the members of color and theme enumerations in IronWord, letting a single member stand for both a readable name and the exact hex code Word stores.

    You attach it to a field by passing the hex string to its constructor, HexValueAttribute(string hexValue), and you read it back through the get-only HexValue property after retrieving the attribute by reflection. Because HexValue is read-only, the value is fixed at the point the member is declared and cannot be reassigned at runtime. In day-to-day code you rarely construct this attribute yourself; it is applied to library enum members, and you consume it by inspecting the HexValue of the member you selected. The add styled text example shows where colored and themed text is configured, and the gradient text effect example applies color stops to text.

    var attribute = new HexValueAttribute("FFFFFF");
    string hex = attribute.HexValue;

    Constructors

    HexValueAttribute(String)

    Declaration
    public HexValueAttribute(string hexValue)
    Parameters
    Type Name Description
    System.String hexValue

    Properties

    HexValue

    Declaration
    public string HexValue { get; }
    Property Value
    Type Description
    System.String
    ☀
    ☾
    Downloads
    • Download with NuGet
    • Start for Free
    In This Article
    Back to top
    Install with NuGet