MyPresenceChooser Style and Template

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

MyPresenceChooser Control

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

<Style x:Key="MyPresenceChooserStyle1" TargetType="controls:MyPresenceChooser">
 <Setter Property="Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelper.PropertyBindingCollection">
  <Setter.Value>
   <Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelperCollection>
    <Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelper Binding="{Binding GlobalTextColor_Black, Source={StaticResource ControlColors}}" Property="Foreground"/>
   </Microsoft_Lync_Internal_Utilities_Helpers:SetterValueBindingHelperCollection>
  </Setter.Value>
 </Setter>
 <Setter Property="Height" Value="16"/>
 <Setter Property="FontSize" Value="10.6"/>
 <Setter Property="Padding" Value="2,0,0,0"/>
 <Setter Property="Width" Value="Auto"/>
 <Setter Property="HorizontalAlignment" Value="Left"/>
 <Setter Property="Template">
  <Setter.Value>
   <ControlTemplate TargetType="controls:MyPresenceChooser">
    <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
     <Microsoft_Lync_Controls_Internal:SplitButton AutomationProperties.AutomationId="MyPresenceChooserSplitButton" Content="{Binding Model.Contact.PresenceItems.ActivityString, RelativeSource={RelativeSource TemplatedParent}}" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsEnabled="{TemplateBinding IsSignedIn}" Padding="{TemplateBinding Padding}" Style="{StaticResource SplitButtonWithoutDefaultStyle}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" Width="Auto">
      <Microsoft_Lync_Controls_Internal:SplitButton.DropDown>
       <Microsoft_Lync_Controls_Internal:ContextMenu AutomationProperties.AutomationId="AvailabilityDropDownMenu" FontSize="10.6" ItemContainerStyle="{StaticResource CustomPresenceMenuItemStyle}" Style="{StaticResource ContextMenuDefaultStyle}">
        <Microsoft_Lync_Controls_Internal:ContextMenu.ItemsSource>
         <Microsoft_Lync_Controls_Internal_Common:CompoundCollection>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetAvailabilityCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserAvailable, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>Free</Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
           <Microsoft_Lync_Controls_Internal:MenuItem.Icon>
            <ContentControl Height="10" Template="{StaticResource ContactAvailability.Solitary.Available}" Width="10"/>
           </Microsoft_Lync_Controls_Internal:MenuItem.Icon>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetAvailabilityCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserBusy, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>Busy</Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
           <Microsoft_Lync_Controls_Internal:MenuItem.Icon>
            <ContentControl Height="10" Template="{StaticResource ContactAvailability.Solitary.Busy}" Width="10"/>
           </Microsoft_Lync_Controls_Internal:MenuItem.Icon>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetAvailabilityCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserDoNotDisturb, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>DoNotDisturb</Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
           <Microsoft_Lync_Controls_Internal:MenuItem.Icon>
            <ContentControl Height="10" Template="{StaticResource ContactAvailability.Solitary.DoNotDisturb}" Width="10"/>
           </Microsoft_Lync_Controls_Internal:MenuItem.Icon>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetAvailabilityCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserBeRightBack, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>TemporaryUnalertable</Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
           <Microsoft_Lync_Controls_Internal:MenuItem.Icon>
            <ContentControl Height="10" Template="{StaticResource ContactAvailability.Solitary.Away}" Width="10"/>
           </Microsoft_Lync_Controls_Internal:MenuItem.Icon>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetActivityIdCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserOffWork, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PublishableActivityId>OffWork</Microsoft_Lync_Controls_Internal_Model:PublishableActivityId>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
           <Microsoft_Lync_Controls_Internal:MenuItem.Icon>
            <ContentControl Height="10" Template="{StaticResource ContactAvailability.Solitary.Away}" Width="10"/>
           </Microsoft_Lync_Controls_Internal:MenuItem.Icon>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetAvailabilityCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserAppearAway, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>Unalertable</Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
           <Microsoft_Lync_Controls_Internal:MenuItem.Icon>
            <ContentControl Height="10" Template="{StaticResource ContactAvailability.Solitary.Away}" Width="10"/>
           </Microsoft_Lync_Controls_Internal:MenuItem.Icon>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Command="{Binding Model.SetAvailabilityCommand, RelativeSource={RelativeSource TemplatedParent}}" Header="{Binding Resources.MyPresenceChooserResetStatus, Converter={StaticResource StringToAcceleratorConverter}, Source={StaticResource ResourcesWrapper}}">
           <Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
            <Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>None</Microsoft_Lync_Controls_Internal_Model:PresenceAvailability>
           </Microsoft_Lync_Controls_Internal:MenuItem.CommandParameter>
          </Microsoft_Lync_Controls_Internal:MenuItem>
          <Microsoft_Lync_Controls_Internal:MenuItem Height="3" IsTabStop="False" Style="{StaticResource MenuItemSeparatorStyle}" Template="{StaticResource MenuItemSeparatorTemplate}" Visibility="{Binding Model.CustomPresenceList, ConverterParameter=1, Converter={StaticResource EnumberableContainsGreaterThanEqualToVisibilityConverter}, RelativeSource={RelativeSource TemplatedParent}}"/>
          <Microsoft_Lync_Controls_Internal_Common:CompoundCollectionPart Collection="{Binding Model.CustomPresenceList, RelativeSource={RelativeSource TemplatedParent}}"/>
         </Microsoft_Lync_Controls_Internal_Common:CompoundCollection>
        </Microsoft_Lync_Controls_Internal:ContextMenu.ItemsSource>
       </Microsoft_Lync_Controls_Internal:ContextMenu>
      </Microsoft_Lync_Controls_Internal:SplitButton.DropDown>
      <Microsoft_Lync_Controls_Internal:SplitButton.RightToolTip>
       <ToolTip Content="{Binding Resources.ToolTipSetAvailability, Source={StaticResource ResourcesWrapper}}" Style="{StaticResource DefaultToolTipStyle}"/>
      </Microsoft_Lync_Controls_Internal:SplitButton.RightToolTip>
     </Microsoft_Lync_Controls_Internal:SplitButton>
    </Border>
   </ControlTemplate>
  </Setter.Value>
 </Setter>
</Style>

See Also

Other Resources

Lync 2010 Controls

Lync 2010 Control Styles and Templates Reference

Customizing Lync 2010 Controls