Topic by Justin Young
Content
I am re-writing an Add-In from scratch and decided that a WPF user control made more sense than trying to deal with layout issues in WinForms.
So I created a new System.Windows.Forms.Integration.ElementHost, added my WPF control as a child to that, and added the element host to the ElemenetHost to the ControlCollection. When I attach to the RightNowCX.exe process and debug, then open the workspace I have added my add-in to, I am able to get through all of my code without error. The add-in will render initially, but after the WorkspaceAddIn constructor exits the add-in disappears from view and I get the following errors:
System.ArgumentException occurred
HResult=-2147024809
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:
at System.Drawing.Bitmap..ctor(Int32 width, Int32 height, PixelFormat format)
InnerException:
System.ArgumentException occurred
HResult=-2147024809
Message=Width and Height must be non-negative.
Source=WindowsBase
StackTrace:
at System.Windows.Size..ctor(Double width, Double height)
InnerException:
Once I click "Do Not Send" the error goes away, and the control re-renders properly.
I have tested this methodology outside of the RightNow framework, and it works perfectly. There are also many documented instances of how to do this, such as here. I have already tried setting minimum heights and widths on both my WPF control and the ElementHost.
I have attached my code.
Version
13.2Image
Image may be NSFW.Clik here to view.
