Back to Devexpress

DropDownButtonItemClickEventArgs.ItemInfo Property

blazor-devexpress-dot-blazor-dot-dropdownbuttonitemclickeventargs.md

latest3.6 KB
Original Source

DropDownButtonItemClickEventArgs.ItemInfo Property

Returns information about the clicked drop-down list item.

Namespace : DevExpress.Blazor

Assembly : DevExpress.Blazor.v25.2.dll

NuGet Package : DevExpress.Blazor

Declaration

csharp
public IDropDownButtonItemInfo ItemInfo { get; }

Property Value

TypeDescription
IDropDownButtonItemInfo

An object that implements the IDropDownButtonItemInfo interface and stores information about the clicked drop-down list item.

|

Remarks

Use the ItemInfo event argument to obtain information about the clicked drop-down list item.

razor
<div class="my-padding">
    @if (ClickedItem != null) {
        <span>Clicked item: <b>@ClickedItem</b></span>
    } else {
        <span>Clicked item: None</span>
    }
</div>

<div class="my-container">
    <DxDropDownButton RenderStyle="ButtonRenderStyle.Secondary"
                      Text="Clipboard"
                      IconCssClass="tb-icon tb-icon-paste"
                      ItemClick=@OnClick
                      CssClass="me-1">
        <Items>
            <DxDropDownButtonItem Text="Cut" IconCssClass="menu-icon-cut menu-icon"/>
            <DxDropDownButtonItem Text="Copy" IconCssClass="menu-icon-copy menu-icon" />
            <DxDropDownButtonItem Text="Paste" IconCssClass="tb-icon tb-icon-paste" />
            <DxDropDownButtonItem Text="Paste Special" BeginGroup="true">
                <Items>
                    <DxDropDownButtonItem Text="Paste Text Only" />
                    <DxDropDownButtonItem Text="Paste Picture" Enabled="false" />
                    <DxDropDownButtonItem Text="Paste as Hyperlink" />
                </Items>
            </DxDropDownButtonItem>
        </Items>
    </DxDropDownButton>
</div>

@code {
    string ClickedItem { get; set; } = "";
    void OnClick(DropDownButtonItemClickEventArgs args) {
        ClickedItem = args.ItemInfo.Text;
    }
}
css
.tb-icon {
    width: 1rem;
    height: 1rem;
    background-size: contain;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    background-position: center center;
    background-color: currentColor;
    opacity: 0.7;
}

.tb-icon-paste {
    -webkit-mask-image: url(../images/paste.svg);
    mask-image: url(../images/paste.svg);
}

.menu-icon-copy {
    mask-image: url(../images/copy.svg);
    -webkit-mask-image: url(../images/copy.svg);
}

.menu-icon-cut {
    mask-image: url(../images/cut.svg);
    -webkit-mask-image: url(../images/cut.svg);
}

.menu-icon {
    width: 1rem;
    height: 1rem;
    min-width: 1rem;
    min-height: 1rem;
    background-size: contain;
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
    background-position: center center;
    background-color: currentColor;
    opacity: 0.7;
}

.dxbl-btn-dropdown .dxbl-btn-dropdown-list-item .dxbl-btn-dropdown-item.dxbl-btn {
    justify-content: flex-start;
}

.my-padding {
    padding-bottom: 20px;
}

.my-container {
    width: 300px; 
    height: 150px;
}

See Also

DropDownButtonItemClickEventArgs Class

DropDownButtonItemClickEventArgs Members

DevExpress.Blazor Namespace