From 93fbfd594d51dd009f7193b695a749978c74ac21 Mon Sep 17 00:00:00 2001 From: Peace Date: Tue, 16 Jul 2024 14:31:07 +0900 Subject: [PATCH] menu button --- .../Components/Layout/NavMenu.razor | 1 + .../Pages/Components/CompoMunuButton.razor | 54 +++++++++++++++++++ BlazorFluentUI/Program.cs | 2 + 3 files changed, 57 insertions(+) create mode 100644 BlazorFluentUI/Components/Pages/Components/CompoMunuButton.razor diff --git a/BlazorFluentUI/Components/Layout/NavMenu.razor b/BlazorFluentUI/Components/Layout/NavMenu.razor index ff51515..fd31a25 100644 --- a/BlazorFluentUI/Components/Layout/NavMenu.razor +++ b/BlazorFluentUI/Components/Layout/NavMenu.razor @@ -54,6 +54,7 @@ Breadcrumb Button + MenuButton diff --git a/BlazorFluentUI/Components/Pages/Components/CompoMunuButton.razor b/BlazorFluentUI/Components/Pages/Components/CompoMunuButton.razor new file mode 100644 index 0000000..7a1ca56 --- /dev/null +++ b/BlazorFluentUI/Components/Pages/Components/CompoMunuButton.razor @@ -0,0 +1,54 @@ +@page "/compomenubutton" +@using Microsoft.FluentUI.AspNetCore.Components.DesignTokens + +@inject AccentBaseColor AccentBaseColor + +@rendermode RenderMode.InteractiveServer + +MenuButton + +The FluentMenuButton component used to trigger a menu. +Menu items can be supplied by both an Items parameter as well as manually as the ChildContent. + +Default + + +

Message: @dmessage?.ToString()

+
+ +Appearances + + +

Neutral

+ +

Accent

+ +

Lightweight

+ +

Outline

+ +

Stealth

+ +
+
+ +@code { + Dictionary items = new Dictionary() + { + {"0078D4","Windows"}, + {"D83B01","Office"}, + {"464EB8","Teams"}, + {"107C10","Xbox"}, + {"8661C5","Visual Studio"}, + {"F2C811","Power BI"}, + {"0066FF","Power Automate"}, + {"742774","Power Apps"}, + {"0B556A","Power Virtual Agents"} + }; + + string dmessage = string.Empty; + void OnDMenuChanged(MenuChangeEventArgs args) + { + dmessage = $"Id: #{args.Id}, Value: {args.Value}"; + } +} diff --git a/BlazorFluentUI/Program.cs b/BlazorFluentUI/Program.cs index 9cf749b..60e7324 100644 --- a/BlazorFluentUI/Program.cs +++ b/BlazorFluentUI/Program.cs @@ -1,6 +1,7 @@ using Microsoft.FluentUI.AspNetCore.Components; using BlazorFluentUI.Components; using BlazorFluentUI.Services; +using Microsoft.FluentUI.AspNetCore.Components.DesignTokens; var builder = WebApplication.CreateBuilder(args); @@ -18,6 +19,7 @@ builder.Services.AddFluentUIComponents(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddTransient(); var app = builder.Build();