MyOpenSpace.MySpacePeopleRequest

Get the Owner's or Viewer's friends

Properties

  • StartIndex Gets the 1-based start index for the friends to return
  • Max Gets or sets the maximum number of friends to return (default is int.Max)
  • PageSize Gets or sets the number of friends to return per page (default is 20)
  • IdSpec the IdSpec the specifies whether you want to get the owner's or the viewer's friends. This can be either
    • "opensocial.IdSpec.PersonId.OWNER"
    • "opensocial.IdSpec.PersonId.VIEWER"
  • People Gets the collection of MyOpenSpace.Person friends for the owner or the viewer. This will only return basic information about the friends (Nickname, ID, ProfileUrl, ThumbnailImage)

Example

Get up to 1,000 of the owner's friends paged in batches of 100 and show their DisplayName and profile picture in a ListBox that uses a WrapPanel. This is the Friends sample in the Kit Source Code.
<UserControl x:Class="Friends.Page"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"  
  xmlns:MyOpenSpace="clr-namespace:MyOpenSpace;assembly=MySpaceSilverlightKit"             
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <UserControl.Resources>
        <MyOpenSpace:MySpacePeopleRequest x:Key="OwnerFriends" 
            IdSpec="opensocial.IdSpec.PersonId.OWNER" Max="1000" PageSize="100" />
        <DataTemplate x:Key="FriendTemplate">
            <Border Background="Silver" CornerRadius="4">
                <StackPanel Margin="2">
                    <Grid Height="100" Width="100">
                        <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Bottom"  
                              Text="" FontFamily="Webdings" FontSize="72" 
                              TextAlignment="Center" Margin="2"/>
                        <Image Margin="2" Source="{Binding ThumbnailImage}" />
                    </Grid>
                    <HyperlinkButton Foreground="Black" Margin="2" 
                        Content="{Binding DisplayName}" 
                        NavigateUri="{Binding ProfileUrl}"/>
                </StackPanel>
            </Border>
        </DataTemplate>
        <ItemsPanelTemplate x:Key="FriendsPanel">
            <controls:WrapPanel/>
        </ItemsPanelTemplate>
    </UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White">
        <ListBox 
            ItemTemplate="{StaticResource FriendTemplate}" 
            ItemsPanel="{StaticResource FriendsPanel}"
            ItemsSource="{Binding People, Source={StaticResource OwnerFriends} }"
            ScrollViewer.HorizontalScrollBarVisibility="Disabled"/>
    </Grid>
</UserControl>

Last edited Apr 1, 2009 at 12:13 AM by mscherotter, version 22

Comments

No comments yet.