How to: Use the Source Property
[This is preliminary documentation and is subject to change.]
This topic demonstrates how to set the Source property of Microsoft Lync Controls. Use the Source property to get or set contact and group URIs for Lync Controls using Microsoft Lync 2013 Preview SDK. For more information, see Understand the Source Property.
Set the Source Property to a String
The following walkthrough sets Name as an extended attribute in XAML to allow the PresenceIndicator control to be referenced in the C# code editor, and then sets the Source property to a string value.
To create the String type walkthrough application
Create a Microsoft Windows Presentation Foundation (WPF) Lync Controls application. For more information, see How to: Publish Presence.
On the Window1.xaml page, find the XAML creating the PresenceIndicator control. Ensure that an extended Name attribute is added, and the Source property is not set, as in the following example.
On the Window1.xaml.cs page, add the following statement in the Window1 constructor following the call to InitializeComponent. Edit the URI to provide a valid value.
Press F5 to build and run the application. The PresenceIndicator control displays the correct presence status for the contact specified using a string in C#.
Set the Source Property to a Contact Object
The following walkthrough uses the GetContactByUri method to return a specific contact, sets the contact to a Contact object, and then sets the Source property to the Contact object.
To create the Contact object walkthrough application
Use steps 1 and 2 from the previous procedure to create a simple application that contains a PresenceIndicator control with the Name attribute added and the Source property not set, as shown in the previous procedure.
In Window1.xaml.cs, add the following using statements.
Add the following statements to the Window1constructor following the call to InitializeComponent. Edit the URI to provide a valid value.
Press F5 to build and run the application. The PresenceIndicator control displays the contact set by the Source property in the previous step.