Back to Devexpress

IRibbonColorPalette Interface

blazor-devexpress-dot-blazor-dot-ribbon-b4147932.md

latest2.5 KB
Original Source

IRibbonColorPalette Interface

Implements the base API for a Ribbon’s color palette component.

Namespace : DevExpress.Blazor.Ribbon

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public interface IRibbonColorPalette :
    IRibbonButtonBase<RibbonColorPaletteClickEventArgs>,
    IRibbonGroupItem,
    IRibbonGroupElement,
    IRibbonElement,
    IRibbonNode,
    IRibbonInteractiveElement,
    IRibbonIconSource,
    IRibbonClickableItem<RibbonColorPaletteClickEventArgs>

The following members return IRibbonColorPalette objects:

Remarks

Use the IRibbonColorPalette interface to read and modify DxRibbonColorPaletteItem component properties at runtime and customize the Ribbon color palette’s appearance and behavior.

Obtain an IRibbonColorPalette instance with the @ref attribute or from Ribbon event arguments.

The following code snippet gets an IRibbonColorPalette reference and adds an automatic color to the palette:

razor
<DxRibbon>
    <DxRibbonTab Text="Home">
        <DxRibbonGroup>
            <DxRibbonItem Text="Add Automatic Color"
                          Click="AddAutomaticColor" />
        </DxRibbonGroup>
        <DxRibbonGroup>
            <DxRibbonColorPaletteItem @bind-Value="color"
                                      @ref="colorPaletteReference">
                <DxRibbonColorGroup Header="Universal"
                                    Colors="@DxColorPalettePresets.GetPalette(ColorPalettePresetType.Universal)" />
            </DxRibbonColorPaletteItem>
        </DxRibbonGroup>
    </DxRibbonTab>
</DxRibbon>

@code {
    string color = "";
    IRibbonColorPalette colorPaletteReference;

    void AddAutomaticColor(RibbonItemClickEventArgs e)
    {
        colorPaletteReference.AutomaticColor = "#000000";
        colorPaletteReference.AutomaticColorCaption = "Black";
    }
}

See Also

IRibbonColorPalette Members

DevExpress.Blazor.Ribbon Namespace