Sdílet prostřednictvím


ContactSearchInputBox Style and Template

This topic describes the style and template for the ContactSearchInputBox 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 Style properties for the ContactSearchInputBox control.

ContactSearchInputBox Control

ContactSearchInputBox Parts

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

Part

Type

Description

ClearButton

Button

Clears the search string.

SearchHint

ContentControl

Provides the content of a search hint.

TextSearch

TextBox

Use this part to display or edit the search string.

ContactSearchInputBox States

The following table lists the visual states for the ContactSearchInputBox control.

VisualState Name

VisualStateGroup Name

Description

SearchInUse

SearchInUseStates

The ContactSearchInputBox control is in use.

SearchNotInUse

SearchInUseStates

The ContactSearchInputBox control is not in use.

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 ContactSearchInputBox control.

<Style x:Key="ContactSearchInputBoxStyle1" TargetType="{x:Type controls:ContactSearchInputBox}">
 <Setter Property="Padding" Value="8,6,8,4" />
 <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:ContactSearchInputBox}">
    <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}">
     <Rtc_System_Windows:VisualStateManager.VisualStateGroups>
      <Rtc_System_Windows:VisualStateGroup x:Name="SearchInUseStates">
       <Rtc_System_Windows:VisualStateGroup.Transitions>
        <Rtc_System_Windows:VisualTransition GeneratedDuration="00:00:00.2000000" />
       </Rtc_System_Windows:VisualStateGroup.Transitions>
       <Rtc_System_Windows:VisualState x:Name="SearchInUse">
        <Storyboard>
         <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="PART_SearchHint" Storyboard.TargetProperty="(UIElement.Opacity)">
          <LinearDoubleKeyFrame KeyTime="00:00:00" Value="0" />
         </DoubleAnimationUsingKeyFrames>
         <ObjectAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="PART_ClearButton" Storyboard.TargetProperty="(UIElement.Visibility)">
          <DiscreteObjectKeyFrame KeyTime="0">
           <DiscreteObjectKeyFrame.Value>
            <Visibility>Visible</Visibility>
           </DiscreteObjectKeyFrame.Value>
          </DiscreteObjectKeyFrame>
         </ObjectAnimationUsingKeyFrames>
        </Storyboard>
       </Rtc_System_Windows:VisualState>
       <Rtc_System_Windows:VisualState x:Name="SearchNotInUse" />
      </Rtc_System_Windows:VisualStateGroup>
     </Rtc_System_Windows:VisualStateManager.VisualStateGroups>
     <Grid Margin="{TemplateBinding Padding}">
      <Grid.RowDefinitions>
       <RowDefinition />
       <RowDefinition />
      </Grid.RowDefinitions>                
      <Border BorderThickness="1" CornerRadius="3" BorderBrush="White">
       <Microsoft_Lync_Controls_Internal:WatermarkedTextBox x:Name="PART_TextSearch" AutomationProperties.AutomationId="ContactSearchInputTextBox" AutomationProperties.Name="Contact search input text box" MaxLength="256" Watermark="{Binding IsSkillSearchEnabled, Converter={StaticResource SearchInputWatermarkConveter}, RelativeSource={RelativeSource TemplatedParent}}" IsEnabled="{TemplateBinding IsSignedIn}" Height="26" BorderThickness="1" BorderBrush="{Binding ContactSearchBorderBrush, Source={StaticResource ControlColors}}" Background="{Binding ContactSearchBackgroundBrush, Source={StaticResource ControlColors}}" Padding="8,0,31,0" Style="{StaticResource GlobalTextBoxSizeStyle.Standard}" Foreground="{Binding GlobalTextColor_Dark, Source={StaticResource ControlColors}}">
        <ToolTipService.ToolTip>
         <ToolTip Style="{StaticResource DefaultToolTipStyle}" Content="{Binding Resources.SearchInputNameTooltip, Source={StaticResource ResourcesWrapper}}" />
        </ToolTipService.ToolTip>
       </Microsoft_Lync_Controls_Internal:WatermarkedTextBox>
      </Border>
      <Microsoft_Lync_Controls_Internal:HelpTextButton x:Name="PART_ClearButton" Style="{StaticResource SearchCancelButtonStyle}" HorizontalAlignment="Right" VerticalAlignment="Center" Height="24" Width="23" Margin="2" IsEnabled="{TemplateBinding IsSignedIn}" Visibility="Collapsed">
       <ToolTipService.ToolTip>
        <ToolTip Style="{StaticResource DefaultToolTipStyle}" Content="{Binding Resources.SearchInputCloseButtonTooltip, Source={StaticResource ResourcesWrapper}}" />
       </ToolTipService.ToolTip>
       <ContentControl HorizontalAlignment="Left" IsHitTestVisible="False" Style="{StaticResource IconStyle.CloseSearch}" />
      </Microsoft_Lync_Controls_Internal:HelpTextButton>
      <ContentControl x:Name="PART_SearchHint" Margin="0,0,4,0" HorizontalAlignment="Right" IsHitTestVisible="False" Style="{StaticResource IconStyle.Search}" />
      <StackPanel Grid.Row="1" Orientation="Horizontal" Height="26">
       <Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton Style="{StaticResource ListFilterRadioButtonStyle}" Content="{Binding Resources.SearchInputFilterName, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" AutomationProperties.AutomationId="NameSearchButton" IsEnabled="{TemplateBinding IsSignedIn}" IsChecked="{Binding SearchType, ConverterParameter=Name, Converter={StaticResource EnumToBoolConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="0,4,0,4">
        <ToolTipService.ToolTip>
         <ToolTip Style="{StaticResource DefaultToolTipStyle}" Content="{Binding Resources.SearchInputNameButtonTooltip, Source={StaticResource ResourcesWrapper}}" />
        </ToolTipService.ToolTip>
       </Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton>
       <Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton Style="{StaticResource ListFilterRadioButtonStyle}" Content="{Binding Resources.SearchInputFilterSkill, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}" AutomationProperties.AutomationId="KeywordSearchButton" IsEnabled="{TemplateBinding IsSignedIn}" IsChecked="{Binding SearchType, ConverterParameter=Skill, Converter={StaticResource EnumToBoolConverter}, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Visibility="{Binding IsSkillSearchEnabled, Converter={StaticResource BooleanToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}">
        <ToolTipService.ToolTip>
         <ToolTip Style="{StaticResource DefaultToolTipStyle}" Content="{Binding Resources.SearchInputSkillButtonTooltip, Source={StaticResource ResourcesWrapper}}" />
        </ToolTipService.ToolTip>
       </Microsoft_Lync_Controls_Internal:EnterEnabledRadioButton>
      </StackPanel>
     </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