Last night I was preparing some ideas for a demo application I need later this week. The demo app had to look good and should be fun and interesting in the making. So I decided to code the UI in Windows Presentation Foundation (WPF). Code in XAML for WPF is simple and one will soon get the hang of it. So I went using some ListViews filled with data via LINQ to SQL and a data class. When I came to implementing Office Communicator 2007 functionality I realized that the “Microsoft Office Communicator 2007 Presence Controls” did only exists as Windows Forms User Controls and not as WPF user controls. Facing the choice of coding my own controls or try to make use of the existing Win Form controls I browsed around and found a XAML tag which enables you to host a windows forms control on a WPF page and the great part about it is really easy to use:
- Download the above mentioned controls from Microsoft and install them.
- Include the managed controls into you WPF project solution.
- Add the WindowsFromHost tag to the WPF XAML page.
- Add the necessary XML name spaces. Look for xmlns:q1 and xmlns:q2 in the example below
- Add the xml tag for persona list control - "q1:Personalist"
Title="Window1" Height="300" Width="300">
Here after you can populate the list via code:
public partial class Window1 : Window
and when you compile you should have something like this.