0

I'm developing an Add-in in C# for Enterprise Architect, when user selects a menu item then a WPF GUI will pop-up.

How can I make this WPF GUI to dock (using docking) on Enterprise Architect GUI? Can I make the add-in GUI dockable?

enter image description here

Ice
  • 193
  • 1
  • 2
  • 13

1 Answers1

2

Yes, you can use Repository.AddTab() or Repository.AddWindow() depending if you want your window to show up in the main diagram part, or as a regular docked window

From the manual:

AddTab (string TabName, string ControlID)

activeX custom control

Notes: Adds an ActiveX custom control as a tabbed window. Enterprise Architect creates a control and, if successful, returns its Unknown pointer, which can be used by the caller to manipulate the control.

Parameters:

TabName: String - used as the tab caption ControlID: String - the ProgID of the control; for example, "CS_AddinFramework.UserControl1"

AddWindow (string WindowName, string ControlID)

Notes: Adds an ActiveX custom control as a window to the Add-Ins docked window. Enterprise Architect creates a control and, if successful, returns its Unknown pointer, which can be used by the caller to manipulate the control.

Parameters:

WindowName: String - used as the window title ControlID: String - the ProgID of the control; for example, "CS_AddinFramework.UserControl1"

You might need to wrap your WPF window into a Winforms Control in order to allow EA to create it as an ActiveX control.

This is an example of an add-in I wrote: the EA Navigator

enter image description here

Geert Bellekens
  • 12,788
  • 2
  • 23
  • 50
  • Now I'm using code below and I want to add this view in Add-Ins Tab from EA: if (_testWindowViewModel == null) _testWindowViewModel = new TestWindowViewModel(repository); _mainWindow = new TestView(_testWindowViewModel); _mainWindow.Show(); – Ice Oct 11 '22 at 14:50
  • First I will transform Window in UserControl (XAML), this user control is bind with a viewModel in behind TestView(_testWindowViewModel). But still can not Add this user control to Add-Ins tab like you have in image above. I tool also the project share by you, but are missing projects like EAAddinFramework and others – Ice Oct 11 '22 at 15:58
  • You have to make sure to register your control in COM. All the other required repositories are available in the same github. – Geert Bellekens Oct 12 '22 at 04:28
  • yes I registered the control in COM and the Addin is in EA, but still for Window and Tab is not working. I attached an example of code with 3 options: pop-up window (working), window that should be in Addin tab (not working) and tab window (not working). I'm using WPF with MVVM. GIT: https://github.com/IcePeak89/EA_Addin.git – Ice Oct 12 '22 at 12:59
  • EA expects an ActiveX control registered in COM. I think you'll need to wrap your WPF into a winforms control to get this working. – Geert Bellekens Oct 12 '22 at 13:26