Demos About Radzen
Search Results for

    Show / Hide Table of Contents

    Context menu setup

    This article shows the additional setup steps required to use the RadzenContextMenu component.

    1. Register the service.
    2. Add the component to your layout.

    Service registration

    The RadzenContextMenu is used via the ContextMenuService class which must be registered as a service.

    • Blazor Server before .NET 6
    • Blazor WebAssembly or Blazor Server after .NET 6
    1. Open Startup.cs
    2. Import the Radzen namespace
      using Radzen;
      
    3. Register the ContextMenuService in the ConfigureServices method.
      public void ConfigureServices(IServiceCollection services)
      {
          // Other registrations
          services.AddScoped<ContextMenuService>();
          // Other registrations
      }
      
    1. Open Program.cs
    2. Import the Radzen namespace
      using Radzen;
      
    3. Register the ContextMenuService in the Main method.
      public static async Task Main(string[] args)
      {
          // Other registrations
          builder.Services.AddScoped<ContextMenuService>();
          // Other registrations
      }
      

    Add to layout

    You also need to add the RadzeContextMenu component to the layout used by your pages (most commonly MainLayout.razor).

    <RadzenContextMenu />
    

    Boost your Blazor development with Radzen

    Radzen is a desktop tool that gives you the power to create line of business applications. Build and launch Blazor apps visually, while we generate clean code for you.

    Learn More

    Download Radzen
    Download Radzen
    In This Article
    Back to top Radzen Blazor Components, © 2018-2022 Radzen. Source Code licensed under MIT