Compartir a través de


CustomContactListItem Style and Template

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

CustomContactListItem Control

CustomContactListItem Parts

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

Part

Type

Description

ContactItem

ContactItem

A listed contact.

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

<Style x:Key="CustomContactListItemStyle1" TargetType="{x:Type controls:CustomContactListItem}" BasedOn="{StaticResource FocusVisualStyleToNullStyle}">
  <Setter Property="Padding" Value="3" />
  <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  <Setter Property="VerticalContentAlignment" Value="Stretch" />
  <Setter Property="Background" Value="Transparent" />
  <Setter Property="BorderThickness" Value="1" />       
  <Setter Property="PersonContentTemplate" Value="{StaticResource PersonContactItemDataTemplateOneLine}" />
  <Setter Property="TelephoneContentTemplate" Value="{StaticResource TelephoneContactItemDataTemplateOneLine}" />
  <Setter Property="BotContentTemplate" Value="{StaticResource BotContactItemDataTemplateOneLine}" />
  <Setter Property="GroupContentTemplate" Value="{StaticResource DistributionListContactItemDataTemplateOneLine}" />        
  <Setter Property="PersonTwoLineContentTemplate" Value="{StaticResource PersonContactItemDataTemplateTwoLines}" />
  <Setter Property="TelephoneTwoLineContentTemplate" Value="{StaticResource TelephoneContactItemDataTemplateTwoLines}" />
  <Setter Property="BotTwoLineContentTemplate" Value="{StaticResource BotContactItemDataTemplateTwoLines}" />
  <Setter Property="GroupTwoLineContentTemplate" Value="{StaticResource DistributionListContactItemDataTemplateTwoLines}" />        
  <Setter Property="Template">
   <Setter.Value>
    <ControlTemplate TargetType="{x:Type controls:CustomContactListItem}">                    
     <Microsoft_Lync_Controls_Internal:PopupContactCardHost x:Name="PART_PopupContactCardHost">
      <Microsoft_Lync_Controls_Internal:PopupContactCardHost.PopupContactCard>
       <Microsoft_Lync_Controls_Internal:PopupContactCard Placement="LeftAndVerticallyCentered" ClickTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" />
      </Microsoft_Lync_Controls_Internal:PopupContactCardHost.PopupContactCard>
      <Rtc_System_Windows:VisualStateManager.VisualStateGroups>
       <Rtc_System_Windows:VisualStateGroup x:Name="CommonStates">
        <Rtc_System_Windows:VisualState x:Name="Normal" />
        <Rtc_System_Windows:VisualState x:Name="MouseOver">
         <Storyboard>
          <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HoverBorder" Storyboard.TargetProperty="Visibility">
           <DiscreteObjectKeyFrame KeyTime="0">
            <DiscreteObjectKeyFrame.Value>
             <Visibility>Visible</Visibility>
            </DiscreteObjectKeyFrame.Value>
           </DiscreteObjectKeyFrame>
          </ObjectAnimationUsingKeyFrames>
         </Storyboard>
        </Rtc_System_Windows:VisualState>
        <Rtc_System_Windows:VisualState x:Name="Disabled" />
       </Rtc_System_Windows:VisualStateGroup>
       <Rtc_System_Windows:VisualStateGroup x:Name="PressedStates">
        <Rtc_System_Windows:VisualState x:Name="NotPressed" />
        <Rtc_System_Windows:VisualState x:Name="Pressed">
         <Storyboard>
          <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedRectangle" Storyboard.TargetProperty="Visibility">
           <DiscreteObjectKeyFrame KeyTime="0">
            <DiscreteObjectKeyFrame.Value>
             <Visibility>Visible</Visibility>
            </DiscreteObjectKeyFrame.Value>
           </DiscreteObjectKeyFrame>
          </ObjectAnimationUsingKeyFrames>
         </Storyboard>
        </Rtc_System_Windows:VisualState>
       </Rtc_System_Windows:VisualStateGroup>
       <Rtc_System_Windows:VisualStateGroup x:Name="SelectionStates">
        <Rtc_System_Windows:VisualState x:Name="Unselected" />
        <Rtc_System_Windows:VisualState x:Name="Selected">
         <Storyboard>
          <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SelectionBorder" Storyboard.TargetProperty="Visibility">
           <DiscreteObjectKeyFrame KeyTime="0">
            <DiscreteObjectKeyFrame.Value>
             <Visibility>Visible</Visibility>
            </DiscreteObjectKeyFrame.Value>
           </DiscreteObjectKeyFrame>
          </ObjectAnimationUsingKeyFrames>
         </Storyboard>
        </Rtc_System_Windows:VisualState>
       </Rtc_System_Windows:VisualStateGroup>
       <Rtc_System_Windows:VisualStateGroup x:Name="FocusStates">
        <Rtc_System_Windows:VisualState x:Name="Focused">
         <Storyboard>
          <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="FocusRectangle" Storyboard.TargetProperty="Visibility">
           <DiscreteObjectKeyFrame KeyTime="0">
            <DiscreteObjectKeyFrame.Value>
             <Visibility>Visible</Visibility>
            </DiscreteObjectKeyFrame.Value>
           </DiscreteObjectKeyFrame>
          </ObjectAnimationUsingKeyFrames>
         </Storyboard>
        </Rtc_System_Windows:VisualState>
        <Rtc_System_Windows:VisualState x:Name="Unfocused" />
       </Rtc_System_Windows:VisualStateGroup>
      </Rtc_System_Windows:VisualStateManager.VisualStateGroups>
      <Grid Background="{TemplateBinding Background}" Microsoft_Lync_Controls_Internal:PopupContactCardHost.IsPlacementTarget="True" Microsoft_Lync_Controls_Internal:PopupContactCardHost.IsHoverOffTarget="True">
       <Border x:Name="SelectionBorder" Visibility="Collapsed" Background="{Binding GlobalListSelectionBackground_Selected, Source={StaticResource ControlColors}}" BorderBrush="{Binding GlobalListSelectionBorder_Selected, Source={StaticResource ControlColors}}" BorderThickness="2" CornerRadius="1" />
       <Border x:Name="HoverBorder" Visibility="Collapsed" BorderBrush="{Binding GlobalListSelectionBorder_Hover, Source={StaticResource ControlColors}}" BorderThickness="1" CornerRadius="1">
        <Rectangle StrokeThickness="1" Stroke="{Binding GlobalListSelectionInnerBorder_Hover, Source={StaticResource ControlColors}}" Fill="{Binding GlobalListSelectionBackground_Hover, Source={StaticResource ControlColors}}" />
       </Border>
       <Rectangle x:Name="PressedRectangle" Visibility="Collapsed" Fill="{Binding GlobalListSelectionBackground_Pressed, Source={StaticResource ControlColors}}" StrokeThickness="1" RadiusX="1" RadiusY="1" />
       <Rectangle x:Name="FocusRectangle" Stroke="{Binding GlobalListSelection_Focus, Source={StaticResource ControlColors}}" StrokeThickness="1" RadiusX="1" RadiusY="1" Visibility="Collapsed" />
       <controls:ContactItem x:Name="PART_ContactItem" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" Source="{TemplateBinding Source}" IsSelected="{TemplateBinding IsSelected}" ContextualInformation="{TemplateBinding ContextualInformation}" ContactLayoutView="{TemplateBinding ContactLayoutView}" ShowFriendlyName="{TemplateBinding ShowFriendlyName}" CallButtonVisibility="{TemplateBinding CallButtonVisibility}" PersonContentTemplate="{TemplateBinding PersonContentTemplate}" TelephoneContentTemplate="{TemplateBinding TelephoneContentTemplate}" BotContentTemplate="{TemplateBinding BotContentTemplate}" GroupContentTemplate="{TemplateBinding GroupContentTemplate}" PersonTwoLineContentTemplate="{TemplateBinding PersonTwoLineContentTemplate}" TelephoneTwoLineContentTemplate="{TemplateBinding TelephoneTwoLineContentTemplate}" BotTwoLineContentTemplate="{TemplateBinding BotTwoLineContentTemplate}" GroupTwoLineContentTemplate="{TemplateBinding GroupTwoLineContentTemplate}" Microsoft_Lync_Controls_Internal:PopupContactCardHost.IsModelTarget="True" />
      </Grid>
     </Microsoft_Lync_Controls_Internal:PopupContactCardHost>
    </ControlTemplate>
   </Setter.Value>
  </Setter>
 </Style>

See Also

Other Resources

Lync 2010 Controls

Lync 2010 Control Styles and Templates Reference

Customizing Lync 2010 Controls