Skip to content

Commit 653fcb5

Browse files
committed
Review dockable pane
1 parent d8a385c commit 653fcb5

1 file changed

Lines changed: 24 additions & 14 deletions

File tree

  • content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos

content/en/docs/apidocs-mxsdk/apidocs/studio-pro-11/extensibility-api/csharp/extensibility-api-howtos/create-dockable-pane.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,18 @@ weight: 5
77

88
## Introduction
99

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.
1111

1212
You can download the example in this how-to in [this GitHub repository](https://github.com/mendix/ExtensionAPI-Samples).
1313

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+
1418
## Creating a Dockable Pane Extension Class
1519

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`.
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`.
1822
3. Replace the code in the file with the following code:
1923

2024
```csharp
@@ -33,13 +37,13 @@ You can download the example in this how-to in [this GitHub repository](https://
3337
}
3438
```
3539

36-
## The View Model for the Extension Tab
40+
## Creating The View Model for the Extension Tab
3741

38-
The dockable pane will have content, and this content comes in the form of a view model. The view model is an implementation of `WebViewDockablePaneViewModel`.
42+
The dockable pane has content, which is provided through a view model. The view model is an implementation of `WebViewDockablePaneViewModel`.
3943

40-
You need to override the `InitWebView` method in which you can set up the content of your web view inside the dockable pane. In this example, it will contain the home page of `http://mendix.com`.
44+
Override the `InitWebView` method, where you can set up the content of your web view inside the dockable pane. In this example, it contains the`http://mendix.com` home page.
4145
42-
Below is a small example code of the view model:
46+
Below is a code example of the view model:
4347

4448
```csharp
4549
using Mendix.StudioPro.ExtensionsAPI.UI.DockablePane;
@@ -57,7 +61,12 @@ public class MyDockablePaneExtensionWebViewModel(string homePage) : WebViewDocka
5761
{{% snippet file="/static/_includes/apidocs-mxsdk/warning-wwwroot.md" %}}
5862
{{% /alert %}}
5963

60-
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:
6170

6271
```csharp
6372
using System.ComponentModel.Composition;
@@ -77,17 +86,18 @@ public class MyMenuExtension(IDockingWindowService dockingWindowService, IMessag
7786
}
7887
```
7988

80-
The code above introduces a few new concepts.
89+
The code above introduces the following concepts:
8190

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
8393

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.
8595

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
8797

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.
8999

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 and using the caption provided. In this case, you do not need a separate `MenuExtension` class.
91101

92102
```csharp
93103
public override string? ViewMenuCaption => "My pane without custom menu";

0 commit comments

Comments
 (0)