I have created tool window in VSIX, now i need to dock that when it open for the first time as per the desired position we set and next time if user moves the tool window it should persist with that position as visual studio doing already.
The below code i have tried, but it always docking to bottom position. how can i change and where i should write to set programmatically.
code snippet:
ToolWindowPane window = this.package.FindToolWindow(typeof(ToolWindow1), 0, true);
if ((null == window) || (null == window.Frame))
{
throw new NotSupportedException("Cannot create tool window");
}
IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame;
windowFrame.SetProperty((int)__VSFPROPID.VSFPROPID_FrameMode, (int)VSFRAMEMODE.VSFM_Dock);
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
Generally, the correct way to achieve this is to use 'Properties of ProvideToolWindowAttribute'.
But I notice this:
https://learn.microsoft.com/en-us/dotnet/api/microsoft.visualstudio.shell.vsdockstyle?view=visualstudiosdk-2022&redirectedfrom=MSDN#remarks
So the situation you encountered is expected, as it is already mentioned in the official document.