VSTO Excel 2010 Moving to 2013 TaskPane Behavior RRS feed

  • Question

  • Hello,

    Visual Studio 2015
    Office 2013 Excel VSTO Add-in
    Language = C#

    NOTE: upgraded code after client moved from Office 2010 (MDI) to Office 2013 (SDI). Trying to make CustomTaskPanes behave.

    PROBLEM OCCURS: when opening the 2nd Excel file (first versions of the CustomTaskPanes work perfectly). Second Excel file, when CustomTaskPanes are added in they have black artifacts and seem diabled (cannot click on controls) I am unable to update graphics driver given work environment. Is there another way you recommend getting rid of the black artifacts? I am using this way to manage the CustomTaskPanes (The only example I could find):

    public class TaskPaneManager
        static Dictionary<string, CustomTaskPane> _createdPanes = new Dictionary<string, CustomTaskPane>();
        /// <summary>
        /// Gets the taskpane by name (if exists for current excel window then returns existing instance, otherwise uses taskPaneCreatorFunc to create one). 
        /// </summary>
        /// <param name="taskPaneId">Some string to identify the taskpane</param>
        /// <param name="taskPaneTitle">Display title of the taskpane</param>
        /// <param name="taskPaneCreatorFunc">The function that will construct the taskpane if one does not already exist in the current Excel window.</param>
        public static CustomTaskPane GetTaskPane(string taskPaneId, string taskPaneTitle, Func<UserControl> taskPaneCreatorFunc)
            string key = string.Format("{0}({1})", taskPaneId, Globals.ThisAddIn.Application.Hwnd);
            if (!_createdPanes.ContainsKey(key))
                var pane = Globals.ThisAddIn.CustomTaskPanes.Add(taskPaneCreatorFunc(), taskPaneTitle);
                _createdPanes[key] = pane;
            return _createdPanes[key];

        private void button1_Click(object sender, RibbonControlEventArgs e)
            var taskpane = TaskPaneManager.GetTaskPane("A", "Task pane type A", () => new UserControl1());
            taskpane.Visible = !taskpane.Visible;
        private void button2_Click(object sender, RibbonControlEventArgs e)
            var taskpane = TaskPaneManager.GetTaskPane("B", "Task pane type B", () => new UserControl2());
            taskpane.Visible = !taskpane.Visible;

    Thursday, May 18, 2017 3:12 PM

All replies

  • >> when CustomTaskPanes are added in they have black artifacts and seem diabled (cannot click on controls

    Could you share us a screen shot about your issue? I made a test with your code by a simple UserControl, it works correctly.

    To check whether it is related with your UserControl, I suggest you make a test with the UserControl which only contains a button to show up message.

    A simple demo which could reproduce your issue would be helpful.

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Thursday, May 25, 2017 9:04 AM