Skip to content

[Word / WPF] Custom Task Panel Contents disappear when document closed #47

@jeffkayser

Description

@jeffkayser

The contents of Custom Task Panes (CTP) containing WPF (UserControl) content disappear when closing a modified Word document. The add-in itself seems to remain loaded, and the space reserved for the CTP remains, but its contents are no longer available/updated.

This can be reproduced using the WordAddIn1 example that comes with VSTOContrib.

Steps to reproduce using the above add-in:

  1. Launch Word with test add-in containing a CTP loaded
  2. Open new, blank document
  3. Enter some text
  4. Select the text to have the add-in populate the CTP with content
    ctp-disappear-0
  5. Click Cancel when the "Do you want to save changes made to Document1"? dialog appears
    ctp-disappear-1
  6. The CTP should have been blanked out during the previous step
    ctp-disappear-2
  7. Note that the CTP content isn't updated/redrawn anymore [0]

[0] Clicking Show Panel in the add-in's Ribbon seems to indicate the CTP has been unloaded, as clicking it gives a NullReferenceException with myAddinTaskPane being null in the PanelShown property setter in DocumentViewModel.cs

Any ideas on how to prevent this from happening? Despite canceling the closing of the document or exiting of Word, it seems as though the CTP is being unloaded. The add-in only behaves normally after closing and relaunching Word.

Please let me know if additional information is required.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions