UI Add-In That Binds to Host Data Sample

This sample demonstrates how to create an add-in pipeline, using the .NET Framework 3.5 add-in model, that enables a WPF host application to do the following:

  1. Host a UI add-in.

  2. Bind the UI add-in's UI to data provided by the WPF host application.

In this sample, there are three add-ins, and each returns a UI to the WPF host as the result of a method call. The method call accepts the host-provided data object as the argument and, ultimately, the add-in UI is bound to the data object. Two add-ins are read-only visualizations of the bound data while one is an editable visualization. When the data object is updated in the host application, property change notification is communicated through the add-in pipeline to all add-ins in order to update their UIs accordingly. Likewise, when the data object is updated by the editable add-in UI, the changes are communicated to the host application and any other add-in UIs bound to the data object. Ultimately, the data in the host application and the add-in UIs stays in sync.

For more information about the programming model that is demonstrated by this sample, see Windows Presentation Foundation Add-Ins Overview.

This sample demonstrates a specific feature of the Windows Presentation Foundation and, consequently, does not follow application development best practices. For comprehensive coverage of Windows Presentation Foundation (WPF) and Microsoft .NET Framework application development best practices, refer to the following as appropriate:

Accessibility - Accessibility Best Practices

Security - Windows Presentation Foundation Security

Localization - WPF Globalization and Localization Overview

Download sample

Building the Sample

  • Install the Windows Software Development Kit (SDK) and open its build environment command window. On the Start menu, point to All Programs, Microsoft Windows SDK, and then click CMD Shell.

  • Download the sample, usually from the software development kit (SDK) documentation, to your hard disk drive.

  • To build the sample from the build environment command window, go to the source directory of the sample. At the command prompt, type MSBUILD.

  • To build the sample in Microsoft Visual Studio, load the sample solution or project file and then press CTRL+SHIFT+B.

Running the Sample

  • To run the compiled sample from the build environment command window, execute the .exe file in the Bin\Debug or Bin\Release folder contained under the sample source code folder.

  • To run the compiled sample with debugging in Visual Studio, press F5.

Change History

Date

History

Reason

July 2008

Added topic.

Information enhancement.