Retemplating the Lync 2010 ContactList Control
Learn how to customize the Microsoft Lync 2010 ContactList control.
Similar to the ContactCard control, there are several parts to a ContactList control that you can customize. The ContactList control includes 2 parts:
The tree view that presents the hierarchical display of groups and contacts.
The toolbar that appears at the top of the contact list.
With Microsoft Expression Blend, you can edit a copy of the template for the ContactList control to customize the toolbar or add an additional component to the basic template for a ContactList control. However, to modify the appearance and/or behavior of the nodes within the tree view control, additional steps are required.
Editing the ContactListGroupItem Template
To customize the template that is used to display top-level group nodes on the ContactList control, complete the following procedure.
To edit the ContactListGroupItem template
The template for a group-level node is applied to an internal control type called ContactListGroupItem. This control is not directly accessible from the ContactList template. To get a copy of the template for a ContactListGroupItem control, you must temporarily add an instance of ContactListGroupItem to your form, and then edit a copy of its template.
<controls:ContactListGroupItem/> <!-- For temporary use -->
In the resulting set of resources, a new style and control template for ContactListGroupItem appears. If you accepted the suggested name for the new style, output that resembles the following appears.
<Style x:Key="ContactListGroupItemStyle1" TargetType="{x:Type controls:ContactListGroupItem}">
Delete the reference to the ContactListGroupItem control that you created in step 1.
Add final changes to the style and the embedded control template. When complete, you can use the new style and template in your ContactList control by setting the GroupItemContainerStyle property.
<controls:ContactList GroupItemContainerStyle="{StaticResource ContactListGroupItemStyle1}"/>
Editing the ContactListItem Templates
The ContactList control uses a variety of DataTemplate resources to control the appearance of people, telephone numbers, bots, and nested distribution groups. There are two data templates for each type of contact:
Name View data template
Picture View data template
These views are sometimes referred to as OneLine and TwoLines view, respectively.
To customize the DataTemplate for one or more view
The template for a contact-level node is applied to an internal control type called ContactListItem. This control is not directly accessible from the ContactList template. To get a copy of the template for a ContactListItem, you must temporarily add an instance of ContactListItem to your form, and then edit a copy of its template.
<controls:ContactListItem/> <!-- For temporary use -->
After you save a copy of the template, delete ContactListItem from your form.
In the resulting set of resources, styles and templates used by the ContactListItem control appear. The DataTemplate objects can be used to customize the appearance of contacts in the ContactList control.
For example, you can modify the template used to display person-type contacts in TwoLines view by customizing the data template that is identified by the key PersonContactItemDataTemplateTwoLines template. After you make your changes, apply the new template by setting the following property on the ContactList control.
<controls:ContactList PersonTwoLineItemTemplate= "{StaticResource PersonContactItemDataTemplateTwoLines}"/>
The following table identifies the templates that can be used to customize the appearance of contacts in the ContactList control.
Contact type |
Layout view |
ContactList property name |
Name of corresponding DataTemplate |
---|---|---|---|
Person |
OneLine |
PersonContactItemDataTemplateOneLine |
|
Person |
TwoLines |
PersonContactItemDataTemplateTwoLines |
|
Telephone |
OneLine |
TelephoneContactItemDataTemplateOneLine |
|
Telephone |
TwoLines |
TelephoneContactItemDataTemplateTwoLines |
|
Bot |
OneLine |
BotContactItemDataTemplateOneLine |
|
Bot |
TwoLines |
BotContactItemDataTemplateTwoLines |
|
Group |
OneLine |
GroupContactItemDataTemplateOneLine |
|
Group |
TwoLines |
GroupContactItemDataTemplateTwoLines |