Skip to main content

Microsoft® Surface® Live Stream Code Sample

ive Stream enables businesses to engage their customers face-to-face using the most recent and relevant Twitter™, Flickr®, and RSS newsfeeds.

C# (5.9 MB)
 
 
 
 
 
4.3 Star
(4)
6,671 times
Add to favorites
4/19/2011
E-mail Twitter del.icio.us Digg Facebook

Solution explorer

C#
<s:SurfaceUserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                      xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                      xmlns:s="http://schemas.microsoft.com/surface/2008"
                      xmlns:controls="clr-namespace:LiveStream.Controls"
                      xmlns:helpers="clr-namespace:LiveStream.Helpers"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      xmlns:props="clr-namespace:LiveStream.Properties"
                      xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
                      mc:Ignorable="d"
                      x:Class="LiveStream.Controls.RiverContent.SmallTweet"
                      xmlns:feeditems="clr-namespace:FeedProcessor.FeedItems;assembly=FeedProcessor"
                      d:DesignWidth="335" d:DesignHeight="96.92">
  <s:SurfaceUserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/LiveStream;component/Resources/Converters.xaml"/>
      </ResourceDictionary.MergedDictionaries>
      <feeditems:StatusFeedItem x:Key="DesignData"
                                Date="6/21/2010 10:23:00 AM"
                                Author="MSSurface"
                                Status="If you have a 140 character Q on the Microsoft Surface SDK, Luis is now on the channel to answer in 140 characters! #Surface #WPF #XNA ^eh" />
    </ResourceDictionary>
  </s:SurfaceUserControl.Resources>
  <Grid d:DataContext="{DynamicResource DesignData}">
    <VisualStateManager.VisualStateGroups>
      <VisualStateGroup x:Name="PressedStates">
        <VisualStateGroup.Transitions>
          <VisualTransition GeneratedDuration="0:0:0.2"/>
          <VisualTransition GeneratedDuration="0:0:0.4" To="NotPressedState"/>
        </VisualStateGroup.Transitions>
        <VisualState x:Name="IsPressedState">
          <Storyboard>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="_background">
              <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
          </Storyboard>
        </VisualState>
        <VisualState x:Name="NotPressedState"/>
      </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Border x:Name="_background" Opacity="{Binding Source={x:Static props:Settings.Default}, Path=TweetOpacity}" Background="Black"/>
    <Grid Margin="6">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
      </Grid.RowDefinitions>
      <Grid>
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <TextBlock Text="{Binding Author}" FontSize="14" TextTrimming="CharacterEllipsis" Opacity=".5" />
        <TextBlock Grid.Column="1" Text="{Binding Date, Converter={StaticResource RelativeTimeConverter}}" FontSize="8" Opacity=".5" TextAlignment="Right" VerticalAlignment="Bottom" >
          <i:Interaction.Behaviors>
            <helpers:RefreshBindingBehavior PropertyToRefresh="Text"/>
          </i:Interaction.Behaviors>
        </TextBlock>
      </Grid>
      <Grid Grid.Row="1" Margin="0,6,0,0">
        <Grid.ColumnDefinitions>
          <ColumnDefinition Width="Auto" />
          <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <controls:ImageLoader Style="{DynamicResource ImageLoaderStyle}" UriSource="{Binding AvatarUri}" Margin="0,0,6,0" Stretch="UniformToFill" Label="{x:Static props:Resources.Avatar}" ClipToBounds="True" HorizontalAlignment="Center" VerticalAlignment="Top" Width="38" Height="38" />
        <TextBlock Grid.Column="1" Text="{Binding Status}" TextWrapping="Wrap" FontSize="10" TextTrimming="WordEllipsis" VerticalAlignment="Top" />
      </Grid>
    </Grid>
  </Grid>
</s:SurfaceUserControl>