Context Menu doesn't show up when screen is small and Have Lot of Items

Hi, I have a Context Menu that doesn't show up when screen is small and Have Lot of Items

For example, I have several items
Image_1029_1693505755969

And they show up normally, when I change to a small screen, the context menu simple don't show up, there is no errors.


Here's my code:

<SfContextMenu Target="#divImagePreview" TValue="MenuItem" EnableScrolling="true">
                        <MenuEvents TValue="MenuItem" ItemSelected="@OnContextSelected" ></MenuEvents>
                        <MenuItems>
                           @foreach(InformacaoCoordenadaViewModel info in TipoCobranca.Identificadores)
                           {
                              <MenuItem Text="@info.Tipo.GetDisplayName()" Id="@info.Tipo.ToString()"></MenuItem>
                           }                    
                        </MenuItems>
                     </SfContextMenu>            


EnableScrolling didn't change any thing

I'm using 

21.1.35

1 Reply

KV Keerthikaran Venkatachalam Syncfusion Team September 4, 2023 06:25 AM UTC

Hi Zmp,


We have checked the reported query, and you can set the ScrollHeight for the menu popup using the OnOpen event of the context menu to achieve your requirements. Please refer to the below code snippet and sample.


@using Syncfusion.Blazor.Navigations

 

<div id="target">Right click/Touch hold to open the ContextMenu </div>

<div class="col-lg-12 control-section">

    <SfContextMenu @ref="menu" Target="#target" TValue="MenuItem" EnableScrolling="true">

        <MenuItems>

            <MenuItem Text="Zoom In"></MenuItem>

            <MenuItem Text="Zoom Out"></MenuItem>

            <MenuItem Text="Reset"></MenuItem>

            <MenuItem Text="Cut" IconCss="em-icons e-cut"></MenuItem>

            <MenuItem Text="Copy" IconCss="em-icons e-copy"></MenuItem>

            <MenuItem Text="Paste" IconCss="em-icons e-paste"></MenuItem>

            <MenuItem Text="Open" IconCss="em-icons e-open"></MenuItem>

            <MenuItem Text="Save" IconCss="em-icons e-save"></MenuItem>

            <MenuItem Separator="true"></MenuItem>

            <MenuItem Text="Exit"></MenuItem>

        </MenuItems>

        <MenuEvents TValue="MenuItem" OnOpen="BeforeOpenHandler"></MenuEvents>

    </SfContextMenu>

</div>

@code {

    private SfContextMenu<MenuItem> menu;

    private bool scroll = true;

    private void BeforeOpenHandler(BeforeOpenCloseMenuEventArgs<MenuItem> args)

    {

        args.ScrollHeight = 175;

    }

}



Sample Link: https://blazorplayground.syncfusion.com/LthANujThrTUOTVE


Get back to us if you need any further assistance on this.


Regards,

KeerthiKaran K V


Loader.
Up arrow icon