Siticone Logo
Siticone UI
DOCS
v2025.12.15
Docs Context Menu Button

Siticone Context Menu Button

The SiticoneContextMenuButton is a comprehensive all-in-one control that combines an animated icon button with a built-in dropdown menu system. It eliminates the need for separate ContextMenuStrip controls by managing its own collection of ContextualMenuItem objects. It features extensive theming, particle-based visual effects (Ripple), sound integration, and a notification badge system.

Manage the dropdown menu directly through the control properties without needing external components.

Property Type Description & Usage Example
MenuItems List<ContextualMenuItem> btn.MenuItems.Add(new ContextualMenuItem("Profile")); The collection of items displayed when the button is clicked. Supports text, images, and custom fonts per item.
MenuBackColor Color btn.MenuBackColor = Color.White; The background color of the dropdown panel.
ShowDropDownShadow bool btn.ShowDropDownShadow = true; If true, the dropdown menu renders a system-level drop shadow (OS dependent).

Theme Engine

The control includes a robust theme manager that styles both the button and the dropdown menu simultaneously.

Property Type Description & Usage Example
CurrentTheme MenuButtonTheme btn.CurrentTheme = MenuButtonTheme.Midnight; Applies a pre-defined color palette to the button and its menu. Options include: Light, Dark, Primary, Neon, Glass, Sunset, etc.
MenuItemHoverBackColor Color btn.MenuItemHoverBackColor = Color.AliceBlue; The background color of a menu item when the mouse hovers over it.
GradientAngle float btn.GradientAngle = 45f; Angle for the button's background gradient (if Start/End colors differ).

Icon & Animations

Customize the vector icon behavior, including morphing animations and continuous effects.

Property Type Description & Usage Example
AnimationType ButtonIconAnimationType btn.AnimationType = ButtonIconAnimationType.MorphToX; The visual effect played on trigger.
MorphToX: Transforms hamburger lines to 'X'.
Pulse: Rhythmic scaling.
Rotate: Spins the icon.
Wavy: Oscillates lines in a wave pattern.
LineStyle ButtonIconLineStyle btn.LineStyle = ButtonIconLineStyle.Rounded; Visual style of the icon lines (Solid, Dotted, Wavy, ZigZag, etc.).
EnableRippleEffect bool btn.EnableRippleEffect = true; Renders a material-design ripple animation upon clicking.
UltraFastPerformance bool btn.UltraFastPerformance = true; Disables high-cost visual effects (Shadows, Gradients, Ripples) for use in data grids or high-density forms.

Badge System

Integrated notification badge for displaying counts (e.g., unread messages).

Property Type Description & Usage Example
BadgeValue int btn.BadgeValue = 3; The number displayed on the badge. Values > 99 are displayed as "99+". Set to 0 to hide the badge.
ButtonMenuBadgePosition Enum btn.ButtonMenuBadgePosition = ButtonMenuBadgePosition.TopRight; Position of the badge: TopRight, TopLeft, BottomRight, BottomLeft.
BadgeBackColor Color btn.BadgeBackColor = Color.Red; Background color of the notification circle.

Events

Events for handling menu selection and state changes.

Event Description
MenuItemClicked Fires when a user selects an item from the dropdown menu. Provides the ContextualMenuItem that was clicked.
MenuOpened Fires when the dropdown menu is shown.
MenuClosed Fires when the dropdown menu is hidden.

Usage Examples

Example 1: Basic Menu Setup

Initializes a context menu button with three items and applies the "Ocean" theme. It handles the MenuItemClicked event to determine which action to take.

C# - Basic Implementation
public void InitializeMenu()
{
                var menuBtn = new SiticoneContextMenuButton();
    
                // 1. Apply Theme
    menuBtn.CurrentTheme = MenuButtonTheme.Ocean;
    
                // 2. Add Items
    menuBtn.MenuItems.Add(new ContextualMenuItem("View Profile"));
    menuBtn.MenuItems.Add(new ContextualMenuItem("Account Settings"));
    menuBtn.MenuItems.Add(new ContextualMenuItem("Logout"));

                // 3. Handle Clicks
    menuBtn.MenuItemClicked += (sender, e) =>
    {
                MessageBox.Show($"Selected: {e.ClickedItem.Text}");
        
                if (e.ClickedItem.Text == "Logout")
        {
                PerformLogout();
        }
    };

                this.Controls.Add(menuBtn);
}

Example 2: Visual Customization

Creates a highly stylized button with a gradient background, a specific icon style (Wavy), and a Pulse animation trigger.

C# - Custom Visuals
private void SetupVisuals()
{
                var btn = new SiticoneContextMenuButton();
    
                // Gradient Background
    btn.BackColorStart = Color.DarkViolet;
    btn.BackColorEnd = Color.BlueViolet;
    btn.GradientAngle = 45f;
    
                // Icon Style
    btn.IconColor = Color.White;
    btn.LineStyle = ButtonIconLineStyle.Wavy;
    btn.IconThickness = 2.5f;

                // Animation
    btn.AnimationType = ButtonIconAnimationType.Pulse;
    btn.AnimationTrigger = ButtonIconAnimationTrigger.OnHover;
    
                this.Controls.Add(btn);
}

Example 3: Validation & ReadOnly Mode

Demonstrates how to lock the menu button based on application state. When IsReadOnly is true, clicking the button triggers a "Shake" animation and a beep instead of opening the menu.

C# - ReadOnly Lock
public void SetBusyState(bool isBusy)
{
                if (isBusy)
    {
                // Lock the menu during busy operations
        menuButton.IsReadOnly = true;
        
                // Provide feedback when user attempts to click
        menuButton.CanShake = true;
        menuButton.CanBeep = true;
        
                // Optional: Change visual appearance to indicate disabled state
        menuButton.ReadOnlyIconColor = Color.Gray;
    }
                else
    {
        menuButton.IsReadOnly = false;
    }
}

Example 4: Badge Notifications

Updates the badge count dynamically. Useful for notification centers or inbox menus.

C# - Badge Update
public void OnNewMessageReceived(int unreadCount)
{
                // Update the number displayed
    menuButton.BadgeValue = unreadCount;
    
                // Customize color based on urgency
                if (unreadCount > 10)
    {
        menuButton.BadgeBackColor = Color.DarkRed;
    }
                else
    {
        menuButton.BadgeBackColor = Color.Red;
    }

                // Set position
    menuButton.ButtonMenuBadgePosition = ButtonMenuBadgePosition.TopRight;
}