Back from vacation. ActionsPane, Part 0.

I took some time off from work for a family vacation. We spent our relaxation week on Vancouver Island in Canada. Here is more info since already couple of people have asked. The place we stayed at is called Beach Acres in Parksville, BC. We rented an ocean view unit with kitchenette and 2 bedrooms. It was just half a minute away from getting to the sand of the beautiful Rathtrevor Beach. The beach is located in the bay which keeps the waters incredibly calm (just like in the pool but with presence of some marine life and without getting allergies from the chlorine). It is very shallow so despite being generally part of the Pacific the water warms up in this place. It also makes for a nice walk during the low-tide. One can wade hundreds of meters into the ocean and dig up the abundant shellfish, catch crabs, build sand castles that are destroyed with the next tide. The kids had fantastic time as well. The only thing that still puzzles me is some irregularity of the tides - one day it would be 2 tides, another day it is 3. It all would happen during different times of the day without any easily understandable cycle. One low-tide could go up to 400 meters away others would be just 200. No recognizable pattern for me whatsoever although reading the local newspapers could help - they do run the tides guide.

So, it was then and now I am back in my office. Oh, not exactly. Eric made some arrangements for part of our team to go on an offsite and spend some time in building 36 with Office. Nothing super secretive but I can not tell you about it to not spoil anything that might come out of this.

In other news - in mid-September I am getting out of my Redmond office and going to PDC. Meeting the customers and seeing their side is always fun and gives us inspiration as well. I am looking forward for this especially since Office has so much content to present they even got a separate track in the conference.

Now back to the ActionsPane. The conception of ActionsPane was a perfect example of a customer driven inspiration. Chris Kunicki was the early adopter of then new SmartDocs technology in Office 2003. SmartDocs umbrella has more than just a programmable task pane but the programmable task pane is the pivotal feature. You could finally plug your own rich UI into Office. Chris was understandably excited and he even contracted to put together samples of SmartDocs that went out as part of Office 2003 Beta programs. He did this only to realize there is something missing to make SmartDocs a success.
Putting together a programmable task pane using SmartDocs technology is not for weak hearted. To name a few difficulties:

  • The central piece is an ISmartDocument interface with 25 methods in it most of which need to be implemented to show a single button control.
  • The controls in the SmartDocs are stateless. Once the cursor moves from one XML element to another the controls were destroyed and re-created again. So it was up to the developer to maintain the controls state.
  • You could have only 1 button click event handler which was called if any of the buttons were clicked. So if you had 5 buttons you needed to assign every one of those an ID. When button was clicked this ID was passed to the event handler (which is just another method on the interface) and you would go from there. Messy...

I can go on and on with the list ... And there was no designer whatsoever! So during the early planning days of VSTO Chris sent an e-mail and ask for the designer experience. Then he asked again. And we would reply that it is very hard to put up a designer to support ISmartDocument interface - it took several years to develop WinForms designer we just did not have the resources. But he would ask again.
And then the light bulb went off. We realized we did not need to create the ISmartDocument designer. All we needed is just to
find a way to host WinForms inside the task pane. This WinForm would fill the entire pane area and would serve as a container for the components designed by the developers.
Then things started to happen with the speed of light. The first prototype was just positioning a WinForm form on top of the
task pane. It had some message routing problems but it did gave people the ability to see the potential behind the concept. The right hosting solution is to host the WinForms natively e.g. the way IE does it - through ActiveX interfaces. Next, Office added the capability to stretch the ActiveX control to fill the task pane area entirely. This was especially incredibly because it happened only 2 months before Office 2003 shipped. Next Brian fixed for us the issues in WinForms that cause some focus management issues - you can see those issues if you use .NET Fx 1.1 to show UserControl in the task pane.

And it was ready. Chris likes to say ActionsPane is his favorite feature and I could not agree more.

In my next posts I will talk about creation of vanilla ActionsPane, then using UserControls to design ActionPane components, adding context sensitivity to the ActionsPane using new XMLNode's ContextEnter and ContextLeave events, discuss some usability aspects of the ActionsPane, answer questions (if any) and possibly provide some peek under the hood.

Comments (9)

  1. Adding programmable task pane aka ActionsPane with VSTO is a piece of cake. All you really need to do…

  2. Eric Lippert says:

    Hey Misha,

    There is a recognizable pattern to the tides, but you need to graph it over a longer period than just a few days to see it.

    The easiest way to think about it is to get medieval and imagine that the sun and moon go around the earth. The sun goes around the earth every 24 hours, the moon goes around the earth every 24 hours 50 minutes.

    When the moon is on your side of the earth, there’s a high tide because the moon is pulling the water away from the earth. When the moon is on the opposite side, it’s pulling the earth away from "your" water. And of course there are low tides between the high tides.

    That explains why there are 2 low tides and two high tides a day, and why they are different sizes. There will always be one very low low tide and one relatively high low tide, and there will also be a high high tide and a low high tide.

    But then we have to take the sun into account as well. The sun also produces a tidal pull, but its every 24 hours, not every 24 hours 50 minutes. When the sun tide and the moon tide line up, the high high and low low tides are much more extreme. During a new moon, when the sun and moon are on the same side, the tides are strongest. During a full moon, when the sun and moon are opposite, they are the second strongest. During 1st and 3rd quarter (ie, half moon) the tides are very weak and tend to stay near the high tide all day.

  3. Adding programmable task pane aka ActionsPane with VSTO is a piece of cake. All you really need to do…

  4. Ankesh says:

    Hi Misha, I have been doing some Smart document programing lately but recently I found some strange behaviour regarding the PaneUpdateComplete event.

    I know that we can only have one instance of ISmartDocument for each solution. But I see that if I have a smart document of one solution say A open and then I open another document of solution type say B. I loose the implentation of PaneUpdateComplete for solution A. The solution A’s paneUpdateCompelte event implementation is replaced with that from solution B.

    This also happens on the Microsoft samples that come with the Smartdocument SDK. The implentation of the event is as simple as MessageBox.Show(Me.gettype.tostring)


    Open Document 1

    System shows a message box Sol1

    Open Document 2

    System shows a message box Sol 2

    Go back to Document 1 (you can even close document 2)

    System shows a message box Sol 2

    Are you aware of this? Is it a known fact (feature?) that I am unaware of?


    Ankesh Mehta

  5. Ankesh,

    I never used the ISmartDocument.OnPaneUpdateComplete and hence were unaware of this. From what you are describing it definitely looks like a bug. All I can do is pass this information on to the Word team. I also suggest you to send the question to the SmartDocs newsgroup

  6. Ankesh says:

    Thanks Misha, I am going to contact Microsoft on this… I think I have a MSDN ticket left. Thanks,

  7. Ram says:

    in the smart document i need to populate some controls in document actions when it is loading itself. where to write code for this.


  8. Wamiq says:

    Hi Misha,

    I have successfully implemented a UserControl into MS Word ActionsPane using VSTO 2005 (.NET 2.0). However, lately I have noticed a very strange behavior with my UserControl.

    My UserControl refuses to respond to any keyboard or mouse input. Any ComboBox/TextBox present on my UserControl do not show any data and appear dead.

    Also any WinForm launched from the ActionsPane (my UserControl) appear to have the same behavior and fail to show any data. I am very worried as there is no information present regarding this issue.

    Best regards,


Skip to main content