Taskpane and WPF form

I’ve made a WPF form to be shown as a new task pane tab. The new tab is triggered by a button in the command bar and randomly is shown ok or “cropped”.

Good show:

Cropped show:

Here’s my snippet code:

//Main class

//Global variables
private static TaskpaneView GeneralTaskPane;

private static SldWorks SwApp;

//Triggered by a command bar button
private void StartTaskPane()
{
    var elementHost = new ElementHost();
    
    GeneralTaskPane = SwApp.CreateTaskpaneView2(string.Empty, "My Taskpane");
    
    elementHost.Child = new MyTaskPane();
    
    var handle = elementHost.Handle.ToInt64();
    
    var retBool = GeneralTaskPane.DisplayWindowFromHandlex64(handle);
}

internal static void CloseTaskPane()
{
    GeneralTaskPane?.DeleteView();
    
    GeneralTaskPane = null;
}

What could be wrong?

There is a bug that when you create two task panes and close one, the second breaks or is hidden as well. I don’t have an SPR number for you, but their side is messy in this regard.

@PeterBrinkhuis,

Which solution do you use for your add-ins: WPF or Windows forms?

@PeterBrinkhuis : Would you be kind enough to list the SPR # for future folks having this issue? Thank you!

​Sure, I think it’s 1216073, which was supposedly fixed in SW2022 SP2. The text in the SPR is useless of course…