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,650 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:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:props="clr-namespace:LiveStream.Properties"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"
                      x:Class="LiveStream.Controls.RiverContent.SmallNews"
                      d:DesignWidth="217" d:DesignHeight="83"
                      xmlns:feeditems="clr-namespace:FeedProcessor.FeedItems;assembly=FeedProcessor">
  <s:SurfaceUserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/LiveStream;component/Resources/Converters.xaml"/>
      </ResourceDictionary.MergedDictionaries>
      <feeditems:NewsFeedItem x:Key="DesignData"
                              Date="6/21/2010 10:23:00 AM"
                              Author="Eric Havir"
                              Title="Surface at WIND Mobile stores in Canada"
                              Summary="WIND Mobile has deployed 20 Microsoft Surface units throughout their mobile stores in Canada last month. Surface is running the &quot;Power of Conversation&quot; application, a consultative tool which allows customers to compare devices and plans side-by-side, helping to identify the options that work best for them. Information is made available quickly, clearly, and in one layer of engagement. Subsequent versions of the application will focus on the customization of services and devices right off the Surface unit."/>
    </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=NewsOpacity}" Background="{DynamicResource ThemeBrush}" />
    <Grid Margin="6">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition Height="*" />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <TextBlock Text="{Binding Title}" FontSize="14" TextWrapping="Wrap" TextTrimming="WordEllipsis" LineStackingStrategy="BlockLineHeight" LineHeight="17" />
      <TextBlock Grid.Row="1" Text="{Binding Summary}" FontSize="10" TextWrapping="Wrap" TextTrimming="WordEllipsis" Margin="0,4,0,0" />
      <StackPanel Grid.Row="2" Orientation="Horizontal" Opacity=".5">
        <TextBlock FontSize="9" Foreground="{DynamicResource ForegroundBrush}" Text="{x:Static props:Resources.Posted}" />
        <TextBlock FontSize="9" Foreground="{DynamicResource ForegroundBrush}">
          <TextBlock.Text>
            <Binding Path="Date" StringFormat="{x:Static props:Resources.DateFormat}" />
          </TextBlock.Text>
        </TextBlock>
        <StackPanel Orientation="Horizontal" Visibility="{Binding Path=Author, Converter={StaticResource VisibilityConverter}}">
          <TextBlock FontSize="9" Foreground="{DynamicResource ForegroundBrush}" Text="{x:Static props:Resources.By}" />
          <TextBlock TextTrimming="CharacterEllipsis" FontSize="9" Foreground="{DynamicResource ForegroundBrush}" Text="{Binding Path=Author}" />
        </StackPanel>
      </StackPanel>
    </Grid>
  </Grid>
</s:SurfaceUserControl>