Skip to content

A Swiss Army knife for developers.

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

<Expander id="@UISettingGroup.Id"
          Class="ui-setting-group-presenter"
          IsVisible="@UISettingGroup.IsVisible"
          IsEnabled="@UISettingGroup.IsEnabled"
          HorizontalAlignment="@UISettingGroup.HorizontalAlignment"
          VerticalAlignment="@UISettingGroup.VerticalAlignment"
          Title="@UISettingGroup.Title"
          Description="@Description"
          IconGlyph="@(UISettingGroup.Icon?.Glyph ?? '\0')"
          IconFontFamily="@UISettingGroup.Icon?.FontName">
    <Control>
        @if (UISettingGroup.InteractiveElement is not null)
        {
            <UIElementPresenter UIElement="@UISettingGroup.InteractiveElement" />
        }
    </Control>
    <ChildContent>
        <StackPanel Orientation="UIOrientation.Vertical"
                    HorizontalAlignment="UIHorizontalAlignment.Stretch"
                    Spacing="0">
            @if (UISettingGroup.Children is not null)
            {
                for (int i = 0; i < UISettingGroup.Children.Length; i++)
                {
                    IUIElement element = UISettingGroup.Children[i];
                    if (element is not null)
                    {
                        if (element is IUISetting)
                        {
                            <UIElementPresenter UIElement="element" />
                        }
                        else
                        {
                            <Container HorizontalAlignment="@element.HorizontalAlignment"
                                       VerticalAlignment="@element.VerticalAlignment"
                                       MarginLeft="55"
                                       MarginRight="45"
                                       MarginBottom="2"
                                       MarginTop="2">
                                <UIElementPresenter UIElement="element" />
                            </Container>
                        }
                    }
                }
            }
        </StackPanel>
    </ChildContent>
</Expander>