I’m trying to create new WPF plugin in Rhinoceros 8 however I’m getting error saying, that “The panel type must have a constructor with a uint, RhinoDoc or no parameters”. The thing is I do have uint in my panel host. This is how my host looks like
/// <summary>
/// Rhino framework requires a System.Windows.Forms.IWin32Window derived object for a panel.
/// </summary>
[System.Runtime.InteropServices.Guid("...")]
public class NewPanelHost : RhinoWindows.Controls.WpfElementHost
{
//WPFInteropPanelBase
public NewPanelHost(uint docsn)
: base(new NewPanel(docsn), null) // No view model (for this example)
{
InitializePanel();
}
void InitializePanel()
{
var panel_id = NewPanel.PanelId;
var panel_visible = Panels.IsPanelVisible(panel_id);
var type = typeof(NewPanel);
if (panel_visible == false)
Panels.OpenPanel(type.GUID);
}
/// <summary>
/// Returns the ID of this panel.
/// </summary>
public static System.Guid PanelId
{
get
{
return typeof(NewPanelHost).GUID;
}
}
}
I don’t know if Rhino has a strong dependency here, but which version of .NET are you using?
The Rhino Developer site says they support .NET Framework. That’s not the same as, for example, .NET 7 or .NET 8 which are the modern versions of .NET. .NET Framework is no longer developed, and when creating a new project in Visual Studio, is usually not the first WPF choice you see.
This may be a non-issue here, but throwing it out in case it is. When I last wrote a Rhino plugin, quite some time ago, it was in .NET Framework.
Hi @karol.wierzbicki - I recently did a refactor of WPF panel inside Rhino and I used the WpfHost not the WpfElementHost like you are using. Maybe it helps?
Had the same problem here and found a solution : get your NewPanelHost class outside of your plugin class. For some reason if it’s declared here it cannot use the constructors properly …