Skip to content

A Swiss Army knife for developers.

1.2 KB
Raw Blame
@namespace DevToys.Blazor.Components.UIElements
@using DevToys.Api;
@inherits ComponentBase

<DropDownButton id="@UIDropDownButton.Id"
                IsVisible="@UIDropDownButton.IsVisible"
                IsEnabled="@UIDropDownButton.IsEnabled"
                HorizontalAlignment="@UIDropDownButton.HorizontalAlignment"
                VerticalAlignment="@UIDropDownButton.VerticalAlignment"
                Items="@MenuItemComponents">
    @if (!string.IsNullOrWhiteSpace(UIDropDownButton.IconFontName) && UIDropDownButton.IconGlyph != '\0')
    {
        <StackPanel Orientiation="UIOrientation.Horizontal" Spacing="4">
            <FontIcon Glyph="@(UIDropDownButton is IUIUtf32IconProvider provider ? provider.Utf32IconGlyph : UIDropDownButton.IconGlyph)"
                      FontFamily="@UIDropDownButton.IconFontName"
                      Height="16"
                      Width="16" />
            @if (!string.IsNullOrEmpty(UIDropDownButton?.Text))
            {
                <TextBlock Text="@UIDropDownButton?.Text" NoWrap="true" />
            }
        </StackPanel>
    }
    else
    {
        <TextBlock Text="@UIDropDownButton?.Text" NoWrap="true" />
    }
</DropDownButton>