API Reference
ToneRule
A conditional formatting rule: when a value matches, the cell takes a tone (the first matching rule wins). Rules compare the presented number when there is one (numbers, bytes, durations in seconds, dates in days from now), so ToneRule.Below(30, ThemeToken.Warn) on a date column flags certificates expiring within 30 days. Without colour, a status tone (pass, warn, fail) adds its symbol in front of the value, so the rule stays visible.
Inheritance
- Object
- ToneRule
Usage
Explore 16 API references to this type
This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.
Returned or exposed by 9
- Method ToneRule.Above
- Method ToneRule.AtLeast
- Method ToneRule.AtMost
- Method ToneRule.Below
- Method ToneRule.Equal
- Method ToneRule.When
- Property KeyValueItem.Rules
- Property RecordItem.Rules
- Property TableColumn.ToneRules
Accepted by parameters 7
- Method CellPresenters.Present
- Method KeyValueList.AddValue
- Method RecordView.AddField
- Extension method TableColumn.AddToneRule
- Extension method TableColumn.AddToneRules
- Method TableColumnFluent.AddToneRule
- Method TableColumnFluent.AddToneRules
Constructors
public ToneRule(Func<Object?, Double?, Boolean> matches, ThemeToken tone) #Creates a rule from a predicate over the raw value and the presented number (when there is one).
Parameters
- matches System.Func<System.Object?, System.Double?, System.Boolean>
- The predicate.
- tone ConsoleMonster.Styling.ThemeToken
- The tone to apply.
Methods
public static ToneRule Above(Double threshold, ThemeToken tone) #ToneRuleMatches numbers greater than a threshold.
Parameters
- threshold System.Double
- The threshold.
- tone ConsoleMonster.Styling.ThemeToken
- The tone.
Returns
The rule.
public static ToneRule AtLeast(Double threshold, ThemeToken tone) #ToneRuleMatches numbers greater than or equal to a threshold.
Parameters
- threshold System.Double
- The threshold.
- tone ConsoleMonster.Styling.ThemeToken
- The tone.
Returns
The rule.
public static ToneRule AtMost(Double threshold, ThemeToken tone) #ToneRuleMatches numbers less than or equal to a threshold.
Parameters
- threshold System.Double
- The threshold.
- tone ConsoleMonster.Styling.ThemeToken
- The tone.
Returns
The rule.
public static ToneRule Below(Double threshold, ThemeToken tone) #ToneRuleMatches numbers less than a threshold.
Parameters
- threshold System.Double
- The threshold.
- tone ConsoleMonster.Styling.ThemeToken
- The tone.
Returns
The rule.
public static ToneRule Equal(Object? expected, ThemeToken tone) #ToneRuleMatches values equal to expected (text comparison, case-insensitive).
Parameters
- expected System.Object?
- The expected value.
- tone ConsoleMonster.Styling.ThemeToken
- The tone.
Returns
The rule.
public Boolean Matches(Object? value, Double? number) #BooleanWhether the rule matches.
Parameters
- value System.Object?
- The raw value.
- number System.Double?
- The presented number, or null.
Returns
True on a match.
public static ToneRule When(Func<Object?, Boolean> predicate, ThemeToken tone) #ToneRuleMatches values for which predicate returns true.
Parameters
- predicate System.Func<System.Object?, System.Boolean>
- The predicate over the raw value.
- tone ConsoleMonster.Styling.ThemeToken
- The tone.
Returns
The rule.
Inherited Methods
public virtual Boolean Equals(Object? obj) #BooleanParameters
- obj Object?