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.
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/build-todo-example-extension.md
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/create-context-menu.md
+17-10Lines changed: 17 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,17 +7,19 @@ weight: 6
7
7
8
8
## Introduction
9
9
10
-
It is possible to add a context menu to an `IEntity` in Studio Pro or to a `IDocument`, such as microflows and pages, etc. Context menus will be placed under a menu named after the extension that contains them (e.g. `MyExtension`) and context menus can modify those items they relate to. You can achieve this simple by specifying the type when creating the extension.
11
-
12
-
This how-to describes how you can add a context menu to an entity. 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
+
You can add a context menu to an `IEntity` in Studio Pro or to a `IDocument`, such as microflows and pages. These context menus will appear under a menu named after the extension that contains them (for example, `MyExtension`) and can modify the items they relate to. This is achieved by specifying the type when creating the extension.
13
11
14
12
You can download the example in this how-to in [this GitHub repository](https://github.com/mendix/ExtensionAPI-Samples).
15
13
14
+
## Prerequisites
15
+
16
+
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.
17
+
16
18
## Creating an Entity Context Menu Extension Class
17
19
18
-
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/).
19
-
2. Add a new class to the project and name it `MyEntityContextMenuExtension.cs`.
20
-
3. Replace the code in the file with the following code:
20
+
1. Open the project you previously created by following[Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
21
+
2. Add a new class to the project named *MyEntityContextMenuExtension.cs*.
22
+
3. Replace the code in the file with the following:
21
23
22
24
```csharp
23
25
namespaceMyCompany.MyProject.MendixExtension;
@@ -90,15 +92,20 @@ You can download the example in this how-to in [this GitHub repository](https://
90
92
}
91
93
```
92
94
93
-
Thecodeabovecreatesaseriesofcontextmenuitemsfor any entity. It is important to note the type `IEntity` is passed in so that the context menu will only apply to entities. It adds menus using the same logic as `MenuExtension.cs`. For more examples, see [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
95
+
Thecodeabovecreatesaseriesofcontextmenuitemsfor any entity. The menus allow you to:
94
96
95
-
Inthecodeabove, youcanseeafewcontextmenusthatcanperformchangesontheentitytheybelongto. InTheentity's location on the canvas can be changed, it can be renamed, and some of its information is shown in a message box.
Copy file name to clipboardExpand all lines: content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/create-dockable-pane.md
+25-15Lines changed: 25 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,15 +7,19 @@ weight: 5
7
7
8
8
## Introduction
9
9
10
-
This how-to describes how you can add a custom dockable web pane window to Studio Pro. 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 custom dockable web pane window to Studio Pro.
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
+
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.
17
+
14
18
## Creating a Dockable Pane 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/).
17
-
2. Add a new class to the project and name it `MyDockablePaneExtension.cs`.
18
-
3. Replace the code in the file with the following code:
20
+
1. Open the project you previously created by following[Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
21
+
2. Add a new class to the project named *MyDockablePaneExtension.cs*.
22
+
3. Replace the code in the file with the following:
19
23
20
24
```csharp
21
25
usingSystem.ComponentModel.Composition;
@@ -33,13 +37,13 @@ You can download the example in this how-to in [this GitHub repository](https://
The code above creates a new web-enabled tab view. You still need a way to show the new dockable pane. To do so, you need to modify the menu extension you added when you followed [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/). Simple replace the existing content of `MyMenuExtension.cs` with the following code:
64
+
## Displaying the Pane Through a Menu
65
+
66
+
To show the new dockable pane, modify the extension you created when following [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
67
+
68
+
1. Open `MyMenuExtension.cs`.
69
+
2. Replace its contents with the following code:
61
70
62
71
```csharp
63
72
usingSystem.ComponentModel.Composition;
@@ -77,17 +86,18 @@ public class MyMenuExtension(IDockingWindowService dockingWindowService, IMessag
77
86
}
78
87
```
79
88
80
-
The code above introduces a few new concepts.
89
+
The code above introduces the following concepts:
81
90
82
-
Firstly, you inject the `IDockingWindowService` so that you can open a new dockable pane.
91
+
* The `IDockingWindowService` is injected to allow opening the dockable pane
92
+
* A new menu item named *Open My Dockable Pane* is added to trigger the pane using the `IDockingWindow` service
83
93
84
-
Secondly, you add a new menu item with the caption **Open My Dockable Pane** that you will use to open your new dockable pane using the `IDockingWindow` service that you have injected.
94
+
Once you have made these changes, build your project. If you have opted to not automatically copy the output to the destination folder, manually copy the bin output from your project to your extension folder you created when you followed the [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/) process.
85
95
86
-
In order for the changes to reflect, you need to build your project. If you have opted to not automatically copy the output to the destination folder, then you will also need to manually copy the bin output from your project to your extension folder you created when you followed [Create a Menu Extension Using C#](/apidocs-mxsdk/apidocs/csharp-extensibility-api-11/create-menu-extension/).
96
+
## Showing a Dockable Pane Without a Custom Menu
87
97
88
-
## Showing a Dockable Pane Without Adding a Custom Menu
98
+
If you prefer to not add a separate menu item to open the docking pane, you can override the `ViewMenuCaption` property in the `DockablePaneExtension` implementation.
89
99
90
-
Instead of adding a separate menu to open the docking pane, you can override the `ViewMenuCaption` property in the implementation of the `DockablePaneExtension`. This means that the menu that opens will be placed under the `View` top-level menu in Studio Pro and will have the caption provided. There is no need for a separate `MenuExtension`in this case.
100
+
This places the menu under the `View` top-level menu in Studio Pro using the caption provided. In this case, you do not need a separate `MenuExtension`class.
91
101
92
102
```csharp
93
103
publicoverridestring?ViewMenuCaption=>"My pane without custom menu";
0 commit comments