Editing the template of a Lync Control
Learn how to use Microsoft Expression Blend 4 to edit the PresenceIndicator control template.
Applies to: Lync 2013 | Lync Server 2013
In this article |
Editing overview
The process used to edit a Microsoft Lync Control template requires comprehension of the standard process used to edit templates with Expression Blend. The PresenceIndicator control is a relatively simple control to retemplate. For information about retemplating complex templates, see Create or modify a template.
Note |
---|
This documentation refers to modifying a Lync Control visual template as "retemplating." |
To edit the PresenceIndicator control template
In Expression Blend, open an existing application that contains a PresenceIndicator instance.
On the Project menu, click Add New Item, and then select Resource Dictionary.
This dictionary is used to hold the resources for the custom styles, templates, and related items that are targeted for edit.
Enter name for the new dictionary, and then click OK.
Note Many Lync Controls share a common set of base styles and resources. If you plan to customize the appearance of more than one Lync Control, consider placing all of the templates in one folder to avoid namespace conflicts in the merged dictionary.
Open the XAML file containing the PresenceIndicator control that you want to customize.
On the View menu, click Active Document View, and then click Design View.
In design view, right-click the PresenceIndicator control, click Edit Template, and then click Edit a Copy.
The Create Style Resource dialog box appears.
In the Create Style Resource dialog box, enter a name for the style, and then select the Define in Resource dictionary option.
Choose the dictionary you created earlier, and then click OK.
The dictionary you created is now populated with a variety of Style resources that are used by the PresenceIndicator control, as well as a copy of the existing PresenceIndicator style that you previously named.
Note The next XAML example is from a Microsoft Windows Presentation Foundation (WPF) project. The actual XAML generated by Expression Blend will be slightly different if you use Microsoft Silverlight, but the process remains unchanged.
In your form, Expression Blend automatically applies the new style to your control. If you used the default name generated by Expression Blend, the result should resemble the following XAML.
<controls:PresenceIndicator Source="sip:scott@contoso.com" PhotoDisplayMode="Large" Style="{DynamicResource PresenceIndicatorStyle1}"/>
Open the resource dictionary and locate your new PresenceIndicator style.
The XAML for the style begins in the following manner.
<Style x:Key="PresenceIndicatorStyle1" TargetType="{x:Type controls:PresenceIndicator}">
In this style, a copy of the template for the presence indicator appears.
<Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type controls:PresenceIndicator}">
Search within the template for the Grid control that defines the core content of the presence indicator. The name of this Grid control is PART_Grid. Add a new resource to the Grid that defines a BlurEffect named CameraShy.
<Grid x:Name="PART_Grid"> <Grid.Resources> <BlurEffect x:Key="CameraShy"/> </Grid.Resources>
A few lines down, an Image control named PART_PhotoImageSmall appears. Add an attribute to this Image control to apply the new CameraShy effect defined earlier. The edited portions appear next. All other items should remain static with edited items.
<Image x:Name="PART_PhotoImageSmall" Effect="{StaticResource CameraShy}"
Run the project and observe the blurring effect.
The presence photo is now enhanced for camera shy persons.