mirror of
https://github.com/radzenhq/radzen-blazor.git
synced 2026-07-08 18:16:08 +00:00
137 document-layer files now use namespace Radzen.Documents.Spreadsheet. 26 UI-layer files keep Radzen.Blazor.Spreadsheet with using added. Test files add using Radzen.Documents.Spreadsheet. Sheet class renamed to Worksheet to match industry conventions.
45 lines
1.5 KiB
Plaintext
45 lines
1.5 KiB
Plaintext
@using Radzen.Blazor.Spreadsheet
|
|
@using Radzen.Documents.Spreadsheet
|
|
@inject DialogService DialogService
|
|
|
|
<RadzenSplitButton Click=@OnClickAsync Icon="format_color_fill" Text="Conditional" Disabled=@IsDisabled ButtonStyle="ButtonStyle.Base" Size="ButtonSize.Small">
|
|
<ChildContent>
|
|
<RadzenSplitButtonItem Text="Greater Than..." Value="greater" />
|
|
<RadzenSplitButtonItem Text="Less Than..." Value="less" />
|
|
<RadzenSplitButtonItem Text="Between..." Value="between" />
|
|
<RadzenSplitButtonItem Text="Equal To..." Value="equal" />
|
|
<RadzenSplitButtonItem Text="Text Contains..." Value="text" />
|
|
</ChildContent>
|
|
</RadzenSplitButton>
|
|
|
|
@code {
|
|
#nullable enable
|
|
|
|
[Parameter]
|
|
public Sheet? Sheet { get; set; }
|
|
|
|
private bool IsDisabled => Sheet?.Selection.Cell == CellRef.Invalid;
|
|
|
|
private async Task OnClickAsync(RadzenSplitButtonItem? item)
|
|
{
|
|
if (Sheet == null || Sheet.Selection.Cell == CellRef.Invalid)
|
|
{
|
|
return;
|
|
}
|
|
|
|
var ruleType = item?.Value ?? "greater";
|
|
|
|
var result = await DialogService.OpenAsync<ConditionalFormatDialog>("Conditional Formatting",
|
|
new Dictionary<string, object?>
|
|
{
|
|
{ "RuleType", ruleType }
|
|
});
|
|
|
|
if (result is ConditionalFormatBase rule)
|
|
{
|
|
var command = new ConditionalFormatCommand(Sheet, Sheet.Selection.Range, rule);
|
|
Sheet.Commands.Execute(command);
|
|
}
|
|
}
|
|
}
|