Class ConditionalFormattingEventArgs
Provides information about the ConditionalFormatting event, which is raised before a conditional formatting rule is applied to a cell range.
Inherited Members
Namespace: Syncfusion.Blazor.Spreadsheet
Assembly: Syncfusion.Blazor.Spreadsheet.dll
Syntax
public class ConditionalFormattingEventArgs
Remarks
This event allows you to intercept the process of applying a conditional formatting rule to a worksheet range.
You can prevent the rule from being applied by setting the Cancel property to true.
The event handler receives the proposed rule, the target range, and the worksheet context so subscribers can inspect or modify the operation before it executes.
Constructors
ConditionalFormattingEventArgs()
Declaration
public ConditionalFormattingEventArgs()
Properties
Cancel
Gets or sets a value indicating whether the conditional formatting operation should be cancelled.
Declaration
public bool Cancel { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | A bool indicating whether the operation should be cancelled. The default value is |
Remarks
When set to true, the conditional formatting rule will not be applied to the worksheet.
This property allows event handlers to prevent the default conditional formatting behavior, for example, based on validation rules or user permissions.
Examples
This example demonstrates how to cancel a conditional formatting operation.
// Cancel conditional formatting on protected ranges
void OnConditionalFormatting(ConditionalFormattingEventArgs args)
{
if (IsProtectedRange(args.Range))
{
args.Cancel = true;
}
}
ConditionalFormatType
Gets the type of conditional formatting rule being applied.
Declaration
public ConditionalFormatType ConditionalFormatType { get; }
Property Value
| Type | Description |
|---|---|
| ConditionalFormatType | A ConditionalFormatType value that determines how the rule evaluates cell values and which visual treatment is applied (for example, |
Remarks
This property is populated from the rule before it is applied, allowing subscribers to inspect or branch on the rule type.
Range
Gets the A1-style range address that the conditional formatting rule will be applied to.
Declaration
public string Range { get; }
Property Value
| Type | Description |
|---|---|
| string | A string in A1 notation (for example, "Sheet1!A1:D10" or "A1:D10"). The default value is |
Remarks
The range may be a single range or a multi-range string. Only the first range is targeted for the rule's primary application; the full multi-range string is preserved on the rule itself.