I have created VSTO outlook addin project. Added user control and other controls. I am able to show/hide custom task pane by clicking on button from Ribbon. I want to minimize and expand it as same as outlook built in Folder Pane does at right side. I am not able to minimize or collapse it as Folder Pane does.
I have added code to change width of task pane but there are two buttons "Task Pane Options" and "Close X" is not letting it to look same as minimized folder pane.
public CustomTaskPane custTaskPane;
public bool isTaskPaneCollapse = false;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
TaskPane tpControl = new TaskPane();
tpControl.BackColor = Color.White;
custTaskPane = this.CustomTaskPanes.Add(tpControl, " ");
custTaskPane.Visible = true;
custTaskPane.Width = 370;
custTaskPane.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
Globals.ThisAddIn.isTaskPaneCollapse = true;
Globals.ThisAddIn.custTaskPane.Width = 20;
}```
What is the right way of doing it? how to implement minimize and expand functionality for custom task pane