ant-design-blazor/components/dropdown/Dropdown.razor
2020-07-02 07:50:27 +08:00

39 lines
1.3 KiB
C#

@namespace AntDesign
@inherits OverlayTrigger
@using AntDesign.Internal
<div class="@ClassMapper.Class"
style="display: inline-block; width: fit-content; @Style"
id="@Id"
@ref="@Ref"
@onclick="OnClickDiv"
@onmouseenter="OnTriggerMouseEnter"
@onmouseleave="OnTriggerMouseLeave"
@oncontextmenu="OnTriggerContextmenu"
@oncontextmenu:preventDefault>
@if (IsButton)
{
<CascadingValue Value="this">
<DropdownGroupButton>
<LeftButton>
<Button @key="1" Size="@_buttonSize" Type="@_buttonType" Disabled="@Disabled">@ChildContent</Button>
</LeftButton>
<RightButton>
<Button @key="2" Size="@_buttonSize" Type="@_buttonType" Disabled="@Disabled" OnClick="OnTriggerClick" Class="ant-dropdown-trigger" Icon="@_rightButtonIcon" />
</RightButton>
</DropdownGroupButton>
</CascadingValue>
}
else
{
@ChildContent
}
</div>
<CascadingValue Value="this" Name="Trigger">
<Overlay @ref="_overlay"
OverlayChildPrefixCls="@($"{PrefixCls}-menu")"
OnOverlayMouseEnter="OnOverlayMouseEnter"
OnOverlayMouseLeave="OnOverlayMouseLeave" />
</CascadingValue>