Share via


ContactSearch Style and Template

This topic describes the styles and templates for the ContactSearch control. You can modify the default ControlTemplate to give the control a unique appearance. For more information, see Customizing Lync 2010 Controls.

There are no states or Style properties for the ContactSearch control.

ContactSearch

ContactSearch Parts

The following table lists the named parts for the ContactSearch control.

Part

Type

Description

ContactSearchInputBox

ContactSearchInputBox

Enables users to search their organization for people based on name, phone number, or skill.

Default Style and Template

The following shows the XML namespace mapping that you have to specify when you work with styles and templates.

xmlns:controls="clr-namespace:Microsoft.Lync.Controls;assembly=Microsoft.Lync.Controls"

The following sample shows the default Windows Presentation Foundation style and template for the ContactSearch control.

<Style x:Key="ContactSearchStyle1" TargetType="{x:Type controls:ContactSearch}">
 <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
 <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
 <Setter Property="Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelper.PropertyBindingCollection">
  <Setter.Value>
   <Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelperCollection>
    <Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelper Property="Background" Binding="{Binding DefaultControlBackgroundBrush, Source={StaticResource ControlColors}}" />
   </Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelperCollection>
  </Setter.Value>
 </Setter>
 <Setter Property="Template">
  <Setter.Value>                
   <ControlTemplate TargetType="{x:Type controls:ContactSearch}">
    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
     <Grid>
      <Grid.RowDefinitions>
       <RowDefinition Height="Auto" />
       <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <controls:ContactSearchInputBox x:Name="ContactSearchInputBox" Grid.Row="0" MaxResults="{Binding MaxResults, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" SearchType="{Binding SearchType, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Background="{TemplateBinding Background}" />
      <controls:ContactSearchResultList Grid.Row="1" ItemsSource="{Binding Results, ElementName=ContactSearchInputBox}" ResultsState="{Binding SearchState, ElementName=ContactSearchInputBox}" SearchType="{Binding SearchType, ElementName=ContactSearchInputBox, Mode=TwoWay}" Visibility="{Binding SearchState, ConverterParameter=Cleared, Converter={StaticResource EnumToNotVisibleConverter}, ElementName=ContactSearchInputBox}" ContextualInformation="{TemplateBinding ContextualInformation}" ScrollViewer.HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" ScrollViewer.VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" Background="{TemplateBinding Background}" />
     </Grid>
    </Border>
   </ControlTemplate>
  </Setter.Value>
 </Setter>
</Style>

See Also

Other Resources

Lync 2010 Controls

Lync 2010 Control Styles and Templates Reference

Customizing Lync 2010 Controls