Partilhar via


Retemplating the Lync 2010 ContactSearch Control

Learn how to retemplate the Microsoft Lync 2010 ContactSearch control.

The template for the ContactSearch control includes two parts:

To change the appearance of either control, embed them in your project individually and then retemplate the control.

Editing the ContactSearchResultlistitem Templates

To modify the templates used to display search results within the ContactSearchResultList control, use a technique similar to the one used to edit contact list items in Retemplating the Lync 2010 ContactList Control.

ContactSearchResultList uses a variety of DataTemplate resources to control the appearance of people, telephone numbers, bots, and distribution lists. To customize the DataTemplate for one or more of these contact types, complete the following procedure.

To edit the ContactSearchResultListItem templates

  1. Before you begin, temporarily add a reference to the following namespace in your form.

    xmlns:internal=
    "clr-namespace:Microsoft.Lync.Controls.Internal;assembly=Microsoft.Lync.Controls"
    
  2. The template for a contact search result is applied to an internal control type called ContactSearchResultListItem. This control is not directly accessible from the ContactSearchResultList template. To get a copy of the templates used by ContactSearchResultListItem, you must temporarily add an instance of ContactSearchResultListItem to your form, and then edit a copy of its template.

    <internal:ContactSearchResultListItem/> <!-- For temporary use -->
    

    Important

    Before moving to step 3, ensure that you reference the internal namespace defined earlier.

  3. After you save a copy of the template, delete ContactSearchResultListItem and the internal namespace definition from your form.

  4. In the resulting set of resources, styles and templates used by the ContactSearchResultListItem control appear. The DataTemplate objects can be used to customize the appearance of contacts in the ContactSearchResultList control. For example, you can modify the template used to display person-type contacts by customizing the data template that is identified by the key PersonSearchResultItemDataTemplate template. After you make your changes, apply the new template by setting the following property on the ContactSearchResultList control.

    <controls:ContactSearchResultList 
            PersonItemTemplate="{StaticResource PersonSearchResultItemDataTemplate}"/>
    

The following table identifies the templates that can be used to customize the appearance of contacts in the ContactSearchResultList control.

Contact type

ContactSearchResultList property name

Name of corresponding DataTemplate

Person

PersonItemTemplate

PersonSearchResultItemDataTemplate

Telephone

TelephoneItemTemplate

TelephoneSearchResultItemDataTemplate

Bot

BotItemTemplate

BotSearchResultItemDataTemplate

Group

GroupItemTemplate

DistributionListSearchResultItemDataTemplate

See Also

Concepts

Retemplating Lync 2010 Controls That Use ContentPresenters

Retemplating Lync 2010 Controls