By following the basic steps which have been outlined above for editing a copy of an existing template using Expression Blend, you will find that the template for the ContactSearch control consist of 2 parts:

  • The ContactSearchInputBox control

  • The ContactSearchResultList control

If you wish to change the appearance of either one of these controls, you should embed them in your project individually, and follow the standard process for retemplating each control as we have previously discussed.

Editing The ContactsearchResultlistitem Templates

However, if you want to modify the templates used for displaying the search results within the ContactSearchResultList control, you must use a technique similar to the one which was described for editing contact list items in the topic Retemplating the ContactList Control .

The ContactSearchResultList uses a variety of different 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, follow the steps outlined below

To edit the ContactSearchResultListItem templates

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

      Copy imageCopy Code
    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. In order to get a copy of the templates used by the ContactSearchResultListItem, you must temporarily add an instance of the control to your form, and follow the normal steps to edit a copy of its template. Remember to reference the internal namespace defined above when you perform this step

      Copy imageCopy Code
    <internal:ContactSearchResultListItem/> <!-- For temporary
    use -->
    
  3. After you make a copy of the template, you can delete this control and the internal namespace definition from your form.

  4. In the resulting set of resources, you will find many styles and templates that are used by the ContactSearchResultListItem control. Among them, you will find various DataTemplate objects which can be used to customize the appearance of contacts in the ContactSearchResultList. For example, you can modify the template used for displaying person-type contacts by customizing the data template that is identified by the key PersonSearchResultItemDataTemplate. After you make your changes, you apply the new template by setting the following property on the ContactSearchResultList:

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

The following table identifies the full set of templates which can be used to customize the appearance of contacts in the ContactSearchResultList:

Contact Type

ContactSearchResultList Property Name

Name of corresponding DataTemplate

Person

PersonItemTemplate

PersonSearchResultItemDataTemplate

Telephone

TelephoneItemTemplate

TelephoneSearchResultItemDataTemplate

Bot

BotItemTemplate

BotSearchResultItemDataTemplate

Group

GroupItemTemplate

DistributionListSearchResultItemDataTemplate

See Also