Change to strongly typed MenuEventArgs<MenuItemModel>

Between Syncfusion.Blazor v18.1.0.58 and v18.2.0.44 the signature of MenuEventArgs has changed (Release Notes). I'm having difficulty trying to accommodate this change and would appreciate your help.

In v18.1.0.58 I declared a Menu item as follows:

  <SfMenu CssClass="dock-menu" Items="@MainMenuItems" Orientation="@VerOrientation" @ref="MainMenu"><MenuEvents ItemSelected="MenuSelect"></MenuEvents></SfMenu>

... and when a menu item was clicked the following Callback would be invoked:

public void MenuSelect(MenuEventArgs args)
{
}

Since updating to v18.2.0.44 the MenuSelect callback (<MenuEvents ItemSelected="MenuSelect"></MenuEvents> ) reports a compile error that says:  "Argument 2: Cannot convert from 'Method group' to 'EventCallback'".

Can you recommend how I should chnage my code to be compatiable with the change you introduced into v18.2.0.44.  Thanks.

Peter,

7 Replies 1 reply marked as answer

MK Mohan Kumar Ramasamy Syncfusion Team July 9, 2020 10:31 AM UTC

Hi Peter, 
 
Sorry for the inconvenience caused. We have changed event arguments as strongly type for Menu Component. Please refer the below code snippet 
 
<SfMenu CssClass="dock-menu" Items="@MainMenuItems"> 
    <MenuEvents ItemSelected="MenuSelect"></MenuEvents> 
</SfMenu> 
@code { 
 
    public void MenuSelect(MenuEventArgs<MenuItemModel> args) 
    { 
    } 
} 
 
For your reference we have prepared a sample. Please find the sample link. 
 
 
Please refer the below link for breaking changes in our release notes. 
 
 
Please let us know if you need any further assistance, 
 
Regards, 
Mohankumar R 


Marked as answer

PE Peter July 9, 2020 10:12 PM UTC

Mohan

Thanks for your prompt response.  That has resolved the problem.

Peter,


MK Mohan Kumar Ramasamy Syncfusion Team July 10, 2020 10:53 AM UTC

Hi Peter, 
 
Thanks for the update.  
 
We are happy to hear that your issue has been resolved. Please feel free to contact us if you need any further assistance on this. 
 
Regards, 
Mohankumar R 



YK yohan kim November 22, 2020 11:39 PM UTC

Hello There,
your code does not work with latest syncfusion update 18.3.35.
Please provide updated example.
Thanks


MK Mohan Kumar Ramasamy Syncfusion Team November 23, 2020 12:43 PM UTC

Hi Yohan, 
 
We have checked your reported query. We have included some breaking changes in Menu component from this version (v18.3.35), We would like you to review the breaking changes from the below location before you upgrade. 
 
 
For your reference, we have updated your sample based on this, please refer below link.  
  
 
Code Snippets 
 
 
@using Syncfusion.Blazor.Navigations 
 
<div class="control-section"> 
    <div class="menu-control"> 
        <SfMenu TValue="MenuItem"> 
            <MenuItems> 
                <MenuItem Text="File" IconCss="em-icons e-file"> 
                    <MenuItems> 
                        <MenuItem Text="Open" IconCss="em-icons e-open"></MenuItem> 
                        <MenuItem Text="Save" IconCss="em-icons e-save" Disabled="false"></MenuItem> 
                        <MenuItem Separator="true"></MenuItem> 
                        <MenuItem Text="Exit"></MenuItem> 
                    </MenuItems> 
                </MenuItem> 
 
                <MenuItem Text="Edit" IconCss="em-icons e-edit"> 
                    <MenuItems> 
                        <MenuItem Text="Cut" IconCss="em-icons e-cut"></MenuItem> 
                        <MenuItem Text="Copy" IconCss="em-icons e-copy"></MenuItem> 
                        <MenuItem Text="Paste"></MenuItem> 
                    </MenuItems> 
                </MenuItem> 
 
                <MenuItem Text="View"> 
                    <MenuItems> 
                        <MenuItem Text="Toolbars"> 
                            <MenuItems> 
                                <MenuItem Text="Menu Bar"></MenuItem> 
                                <MenuItem Text="Bookmarks Toolbar"></MenuItem> 
                                <MenuItem Text="Customize"></MenuItem> 
                            </MenuItems> 
                        </MenuItem> 
                        <MenuItem Text="Zoom"> 
                            <MenuItems> 
                                <MenuItem Text="Zoom In"></MenuItem> 
                                <MenuItem Text="Zoom Out"></MenuItem> 
                                <MenuItem Text="Reset"></MenuItem> 
                            </MenuItems> 
                        </MenuItem> 
                        <MenuItem Text="Full Screen"></MenuItem> 
                    </MenuItems> 
                </MenuItem> 
                <MenuItem Text="Tools"> 
                    <MenuItems> 
                        <MenuItem Text="Spelling & Grammar"></MenuItem> 
                        <MenuItem Text="Customize"></MenuItem> 
                        <MenuItem Separator="true"></MenuItem> 
                        <MenuItem Text="Options"></MenuItem> 
                    </MenuItems> 
                </MenuItem> 
                <MenuItem Text="Help"></MenuItem> 
            </MenuItems> 
            <MenuEvents ItemSelected="Select" TValue="MenuItem"></MenuEvents> 
        </SfMenu> 
 
    </div> 
</div> 
 
@code { 
    private void Select(MenuEventArgs<MenuItem> args) 
    { 
 
    } 
} 
 
 
  
Please let us know, if you need any further assistance.  
  
Regards,  
Mohan kumar R  



PH Philippe March 31, 2021 08:59 PM UTC

Your sample don't work

I try all your methos, nothing working


AS Aravinthan Seetharaman Syncfusion Team April 1, 2021 10:10 AM UTC

Hi Philippe, 
 
We have checked your query. We cannot reproduce your reported issue in our latest version v19.1.0.54. For your reference we have prepared code snippet and Sample here. 
 
Index.razor 
@using Syncfusion.Blazor.Navigations 
 
<div class="control-section"> 
    <div class="menu-control"> 
        <SfMenu TValue="MenuItem"> 
            <MenuItems> 
                <MenuItem Text="File" IconCss="em-icons e-file"> 
                    <MenuItems> 
                        <MenuItem Text="Open" ></MenuItem> 
                        <MenuItem Text="Save" ></MenuItem> 
                        <MenuItem Separator="true"></MenuItem> 
                        <MenuItem Text="Exit"></MenuItem> 
                    </MenuItems> 
                </MenuItem> 
           . . . 
              </MenuItems> 
            <MenuEvents ItemSelected="Select" TValue="MenuItem"></MenuEvents> 
        </SfMenu> 
 
    </div> 
</div> 
 
@code { 
    private void Select(MenuEventArgs<MenuItem> args) 
    { 
        // Your code here. 
    } 
} 
 
 
 
If you are still facing the issue, kindly share the below details. 
 
·        If possible, try to reproduce the reported issue in provided sample or share the issue reproducible sample. 
·        Please share us the video demonstration of this issue. 
·        Please share us the Syncfusion Package Version. 
 
Please provide the above requested information, based on that we will check and provide you a better solution quickly. 
 
Regards, 
Aravinthan S 


Loader.
Up arrow icon