Wednesday, June 24, 2009

Use WPF User control to display in a Task Pane


Use the following code in your Ribbon OnAction method to display a WPF User control in an office task pane:

Dim pane As WPFUserControlName= Nothing

If pane Is Nothing Then
Dim uControl As New UserControl()
Dim host As ElementHost = New ElementHost()

pane = New WPFUserControlName()

host.Child = pane
host.Dock = DockStyle.Left
host.Width = 200


taskPane = Globals.ThisAddIn.CustomTaskPanes.Add(uControl, "Biographies")
taskPane.Visible = True
taskPane.Visible = True
End If

No comments: