When creating a TaskDetails page, I found a quirk that seems unintended. Our PDM Add-in is written in VB.Net and I prefer to write in C#, so anytime that I have a new feature being added I choose to add it as another project, or if it fits in an existing C# project that I’ve already created.
So I’ve got the structure of:
PDMAddin.dll (VB.Net)
→ TaskLogic.dll (C#)
This works great as it gives me the flexibility to program in my preferred language and I can add simple logic in the VB.Net code to hook into the new code I’m writing.
Where I ran into an issue is the TaskDetails command would not build the UserControl whenever it was in the TaskLogic.dll, but if I added a UserControl in PDMAddin and passed it to the method in TaskLogic.dll, I can add whatever controls I want to at runtime. I’m specifically passing an ElementHost so I can add a WPF UI to the TaskDetails page, but it could be either.
So the logic I’m using to set it up is:
- Create a UserControl in PDMAddin.dll
- Add an ElementHost as a child (make sure this is set to Dock = DockStyle.Fill)
- Pass the ElementHost to TaskLogic.dll
- Set the WPF UserControl as the child of the ElementHost passed from PDMAddin.dll
This workaround seems to be stable and the only way I was able to accomplish this within the constraints I gave myself.