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:controls="clr-namespace:LiveStream.Controls"
                      xmlns:props="clr-namespace:LiveStream.Properties"
                      xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                      xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                      mc:Ignorable="d"
                      x:Class="LiveStream.Controls.RiverContent.LargeImage"
                      d:DesignWidth="334" d:DesignHeight="398"
                      xmlns:feeditems="clr-namespace:FeedProcessor.FeedItems;assembly=FeedProcessor">
  <s:SurfaceUserControl.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/LiveStream;component/Resources/Converters.xaml"/>
      </ResourceDictionary.MergedDictionaries>
      <feeditems:ImageFeedItem x:Key="DesignData"
                               Date="6/21/2010 10:23:00 AM"
                               Author="MSSurface"
                               Title="This is the image title"
                               Caption="This is the excellent image caption which is a description of the excellent image."/>
    </ResourceDictionary>
  </s:SurfaceUserControl.Resources>
  <Grid d:DataContext="{DynamicResource DesignData}">
    <VisualStateManager.VisualStateGroups>
      <VisualStateGroup x:Name="ManipulatingStates">
        <VisualStateGroup.Transitions>
          <VisualTransition GeneratedDuration="0:0:0.2"/>
        </VisualStateGroup.Transitions>
        <VisualState x:Name="NotManipulatingState"/>
        <VisualState x:Name="IsManipulatingState">
          <Storyboard>
            <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="_manipulatingBorder">
              <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
            </DoubleAnimationUsingKeyFrames>
          </Storyboard>
        </VisualState>
      </VisualStateGroup>
    </VisualStateManager.VisualStateGroups>
    <Border Background="{DynamicResource ForegroundBrush}"/>
    <Grid Margin="5">
      <Grid.Clip>
        <RectangleGeometry RadiusX="35" RadiusY="35" Rect="0,0,1500,1500"/>
      </Grid.Clip>
      <Grid.RowDefinitions>
        <RowDefinition Height="40" />
        <RowDefinition Height="*" />
        <RowDefinition Height="40" />
      </Grid.RowDefinitions>
      <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*" />
        <ColumnDefinition Width="40" />
      </Grid.ColumnDefinitions>

      <controls:ManipulationViewport x:Name="_viewport" x:FieldModifier="private" Grid.RowSpan="3" Grid.ColumnSpan="2" Style="{DynamicResource ManipulationViewportStyle}" IsAnyContactCapturedWithinChanged="Viewport_IsAnyContactCapturedWithinChanged" MaximumScaleFactor="2">
        <controls:ImageLoader Style="{DynamicResource ImageLoaderStyle}" Foreground="{DynamicResource ThemeBrush}" x:Name="_image" x:FieldModifier="private" Stretch="UniformToFill" Label="{x:Static props:Resources.Image}" />
      </controls:ManipulationViewport>

      <Border Background="#B2000000" Padding="25,5,5,5" BorderThickness="0,0,2,0">
        <StackPanel VerticalAlignment="Center">
          <TextBlock Text="{Binding Title}" FontSize="14" Foreground="{DynamicResource ForegroundBrush}" TextTrimming="CharacterEllipsis" />
          <StackPanel Orientation="Horizontal" Opacity=".5">
            <TextBlock FontSize="9" Foreground="{DynamicResource ForegroundBrush}" Text="{x:Static props:Resources.Posted}" />
            <TextBlock TextTrimming="WordEllipsis" FontSize="9" Foreground="{DynamicResource ForegroundBrush}">
            <TextBlock.Text>
              <Binding Path="Date" StringFormat="{x:Static props:Resources.DateFormat}" />
            </TextBlock.Text>
            </TextBlock>
            <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>
      </Border>

      <Border Background="#B2000000" Grid.Row="2" Padding="11,5" Margin="0,0,2,0">
        <TextBlock Text="{Binding Caption}" FontSize="10" TextWrapping="Wrap" TextTrimming="WordEllipsis" />
      </Border>

      <Border x:Name="_manipulatingBorder" x:FieldModifier="private" BorderBrush="{DynamicResource ThemeBrush}" BorderThickness="3" CornerRadius="34,0,0,0" Grid.RowSpan="3" Grid.ColumnSpan="2" Margin="3" Opacity="0" IsHitTestVisible="False" />

      <Border BorderBrush="#00FF0000" BorderThickness="25" Grid.Row="1" Grid.ColumnSpan="2" />

      <s:SurfaceButton x:Name="_closeBtn" x:FieldModifier="private" ContactTapGesture="Close_ContactTapGesture" Grid.Column="1" Style="{DynamicResource ImageCloseButtonStyle}" Foreground="{DynamicResource ForegroundBrush}" Background="{DynamicResource ThemeBrush}"/>
      <s:SurfaceButton x:Name="_flipBtn" x:FieldModifier="private" ContactTapGesture="Flip_ContactTapGesture" Grid.Column="1" Grid.Row="2" Padding="0" Style="{DynamicResource ImageFlipButtonStyle}" Background="{DynamicResource ThemeBrush}" />

    </Grid>
  </Grid>
</s:SurfaceUserControl>