You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/add-menu.md
+42-7Lines changed: 42 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,19 @@ weight: 15
7
7
8
8
## Introduction
9
9
10
-
This how-to describes how you can add a menu that contains submenus, some of which also contain submenus of their own. Before you start this how-to, it is recommended to [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/) first.
10
+
This how-to describes how to add a menu that contains sub-menus, some of which also contain sub-menus of their own.
11
11
12
12
You can download the example in this how-to in [this GitHub repository](https://github.com/mendix/ExtensionAPI-Samples).
13
13
14
+
## Prerequisites
15
+
16
+
This how-to uses the results of [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/). Complete that how-to before starting this one.
17
+
14
18
## Creating Menu Extension Class
15
19
16
-
1. Open the project that you previously created when you followed[Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
20
+
1. Open the project you created when following[Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
17
21
2. Add a new class to the project and name it `MyMenuExtension.cs`.
18
-
3. Replace the code in the file with the following code:
22
+
3. Replace the code in the file with the following:
19
23
20
24
```csharp
21
25
usingMendix.StudioPro.ExtensionsAPI.UI.Menu;
@@ -57,10 +61,41 @@ You can download the example in this how-to in [this GitHub repository](https://
57
61
}
58
62
```
59
63
60
-
Thecodeabovecreatesasinglemenu, `Beverages`, whichcontainsthesubmenus `Hot` and `Cold`, bothofwhichcontainsomesubmenus. Notethatwhenyouarecreatingthismenustructure, youonlyreturnthemainparentmenu (inthisexample, the `Beverages` menu) fromthe `GetMenus` method. Youshouldonlyreturnthetopmostparentsinyourlist, soonlytheonesthatdonothaveaparentshouldbereturned. Intheexampleabove, thereisonlyone.
0 commit comments