I'm trying to embed a Unity3D-ActiveX control into a WPF-Form by using a WinFormsHost-Control.
Actually it works well when setting the path in the property window of VS, but when setting it in my code file it does not load anything. This is a known issue of the control but i thought i can simply copy the creation code of the forms-designer and initialize it manually.
When looking at the code of the initialization i noticed that there is no src
property in the code, but the property is used in the property window. Setting the property manually does not work ( throws a error ).
After some test's i decided to check the hole assembly for the src
property, but the src
property is never set and i can't even find the string of the path.
Final thoughts
I noticed that there can be only one place where the src-path is located: The resource generated by the window forms designer, which is a object of the AxHost.State-type.
Question
How do i create a valid AxHost.State
object to initialize the Unity3D-ActiveX control which should load a Unity3D-file specified by me?
This is the solution which works but is a little bit slow( Note: You need to initialize the Control once in the Forms Designer and copy the OcxState object into the assembly resources ):