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,627 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:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Microsoft_Surface_Presentation_Generic="clr-namespace:Microsoft.Surface.Presentation.Generic;assembly=Microsoft.Surface.Presentation.Generic" mc:Ignorable="d" x:Class="LiveStream.Controls.AdminLayer"
                      d:DesignWidth="1024" d:DesignHeight="768">
  <s:SurfaceUserControl.Resources>
    <Storyboard x:Key="ShowAdminPanel">
      <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="_panelContainer">
        <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
      </ObjectAnimationUsingKeyFrames>
      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="_panelContainer">
        <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
        <SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
      </DoubleAnimationUsingKeyFrames>
    </Storyboard>
    <Storyboard x:Key="HideAdminPanel">
      <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="_panelContainer">
        <DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Collapsed}"/>
      </ObjectAnimationUsingKeyFrames>
      <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="_panelContainer">
        <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
        <SplineDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
      </DoubleAnimationUsingKeyFrames>
    </Storyboard>
  	<Style x:Key="ScatterViewItemStyle" TargetType="{x:Type s:ScatterViewItem}">
  		<Setter Property="Background">
  			<Setter.Value>
  				<LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
  					<GradientStop Color="#FFA4B4BD" Offset="0"/>
  					<GradientStop Color="#FFDFE9EE" Offset="1"/>
  				</LinearGradientBrush>
  			</Setter.Value>
  		</Setter>
  		<Setter Property="BorderBrush" Value="#33000000"/>
  		<Setter Property="Foreground" Value="#FF515151"/>
  		<Setter Property="BorderThickness" Value="1"/>
  		<Setter Property="HorizontalContentAlignment" Value="Stretch"/>
  		<Setter Property="VerticalContentAlignment" Value="Stretch"/>
  		<Setter Property="MinWidth" Value="48"/>
  		<Setter Property="MinHeight" Value="48"/>
  		<Setter Property="Template">
  			<Setter.Value>
  				<ControlTemplate TargetType="{x:Type s:ScatterViewItem}">
  					<ControlTemplate.Resources>
  						<Storyboard x:Key="DeactivationTimeline">
                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="activeBorder">
                  <SplineDoubleKeyFrame KeyTime="0" Value="1"/>
                  <SplineDoubleKeyFrame KeySpline="0,0,0.148,0.933" KeyTime="0:0:0.75" Value="0"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="container">
  								<SplineDoubleKeyFrame KeyTime="0" Value="1.03"/>
  								<SplineDoubleKeyFrame KeySpline="0,0,0.148,0.933" KeyTime="0:0:0.75" Value="1.01"/>
  							</DoubleAnimationUsingKeyFrames>
  							<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="container">
  								<SplineDoubleKeyFrame KeyTime="0" Value="1.03"/>
  								<SplineDoubleKeyFrame KeySpline="0,0,0.148,0.933" KeyTime="0:0:0.75" Value="1.01"/>
  							</DoubleAnimationUsingKeyFrames>
  							<ThicknessAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="shadow">
  								<SplineThicknessKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="0:0:0.75" Value="-4"/>
  							</ThicknessAnimationUsingKeyFrames>
  							<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome.MaximumShadowOffset)" Storyboard.TargetName="shadow">
  								<SplineDoubleKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="0:0:0.75" Value="0"/>
  							</DoubleAnimationUsingKeyFrames>
  							<ColorAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome.Color)" Storyboard.TargetName="shadow">
  								<SplineColorKeyFrame KeyTime="0:0:0.75" Value="#26000000"/>
  							</ColorAnimationUsingKeyFrames>
  							<PointAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="Sheen">
  								<SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="0" Value="1.241,0.304"/>
  								<SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="0:0:0.75" Value="-0.636,0.132"/>
  								<SplinePointKeyFrame KeyTime="0:0:0.775" Value="-1.146,-0.035"/>
  							</PointAnimationUsingKeyFrames>
  							<PointAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="Sheen">
  								<SplinePointKeyFrame KeySpline="0,0,0,0" KeyTime="0" Value="1.879,0.551"/>
  								<SplinePointKeyFrame KeySpline="0,0,0.15,0.93" KeyTime="0:0:0.75" Value="0.018,0.291"/>
  								<SplinePointKeyFrame KeyTime="0:0:0.775" Value="-0.492,0.124"/>
  							</PointAnimationUsingKeyFrames>
  						</Storyboard>
  						<Storyboard x:Key="ActivationTimeline">
                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="activeBorder">
                  <SplineDoubleKeyFrame KeyTime="0" Value="0"/>
                  <SplineDoubleKeyFrame KeySpline="0,0,0.148,0.933" KeyTime="0:0:0.75" Value="1"/>
                </DoubleAnimationUsingKeyFrames>
                <DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)" Storyboard.TargetName="container">
  								<SplineDoubleKeyFrame KeyTime="0" Value="1.01"/>
  								<SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="0:0:0.45" Value="1.03"/>
  							</DoubleAnimationUsingKeyFrames>
  							<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleY)" Storyboard.TargetName="container">
  								<SplineDoubleKeyFrame KeyTime="0" Value="1.01"/>
  								<SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="0:0:0.45" Value="1.03"/>
  							</DoubleAnimationUsingKeyFrames>
  							<DoubleAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome.MaximumShadowOffset)" Storyboard.TargetName="shadow">
  								<SplineDoubleKeyFrame KeyTime="0" Value="0"/>
  								<SplineDoubleKeyFrame KeySpline="0,1,1,1" KeyTime="0:0:0.45" Value="25"/>
  							</DoubleAnimationUsingKeyFrames>
  							<ThicknessAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(FrameworkElement.Margin)" Storyboard.TargetName="shadow">
  								<SplineThicknessKeyFrame KeyTime="0" Value="-3"/>
  								<SplineThicknessKeyFrame KeySpline="0,1,1,1" KeyTime="0:0:0.45" Value="0"/>
  							</ThicknessAnimationUsingKeyFrames>
  							<ColorAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome.Color)" Storyboard.TargetName="shadow">
  								<SplineColorKeyFrame KeyTime="0" Value="#26000000"/>
                  <SplineColorKeyFrame KeyTime="0:0:0.45" Value="#55000000"/>
  							</ColorAnimationUsingKeyFrames>
  							<PointAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.StartPoint)" Storyboard.TargetName="Sheen">
  								<SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="0:0:1.1" Value="1.182,0.441"/>
  							</PointAnimationUsingKeyFrames>
  							<PointAnimationUsingKeyFrames BeginTime="0" Storyboard.TargetProperty="(Shape.Fill).(LinearGradientBrush.EndPoint)" Storyboard.TargetName="Sheen">
  								<SplinePointKeyFrame KeySpline="0,1,1,1" KeyTime="0:0:1.1" Value="1.929,0.949"/>
  							</PointAnimationUsingKeyFrames>
  						</Storyboard>
  					</ControlTemplate.Resources>
  					<Grid x:Name="container" RenderTransformOrigin="{TemplateBinding RenderTransformOrigin}">
  						<Grid.RenderTransform>
  							<ScaleTransform ScaleY="1" ScaleX="1"/>
  						</Grid.RenderTransform>
  						<Microsoft_Surface_Presentation_Generic:SurfaceShadowChrome x:Name="shadow" Color="#33000000" Margin="-4" ShadowVector="{TemplateBinding ShadowVector}"/>
              <Border x:Name="activeBorder" BorderBrush="{DynamicResource ThemeBrush}" BorderThickness="3" Margin="-5" Opacity="0" />
              <Border x:Name="contentBorder" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
  							<ContentPresenter ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  						</Border>
  						<Rectangle x:Name="Sheen" Focusable="False" HorizontalAlignment="Stretch" IsHitTestVisible="False" Opacity="0.6" VerticalAlignment="Stretch">
  							<Rectangle.Fill>
  								<LinearGradientBrush EndPoint="-0.234,0.37" StartPoint="-0.981,-0.138">
  									<GradientStop Color="Transparent" Offset="0"/>
  									<GradientStop Color="#33FFFFFF" Offset="0.52"/>
  									<GradientStop Color="Transparent" Offset="1"/>
  								</LinearGradientBrush>
  							</Rectangle.Fill>
  						</Rectangle>
  					</Grid>
  					<ControlTemplate.Triggers>
              <MultiTrigger>
                <MultiTrigger.Conditions>
                  <Condition Property="IsActive" Value="True"/>
                  <Condition Property="ShowsActivationEffects" Value="True"/>
                </MultiTrigger.Conditions>
                <MultiTrigger.EnterActions>
                  <BeginStoryboard x:Name="ActivationTimeline_BeginStoryboard" Storyboard="{StaticResource ActivationTimeline}" />
                </MultiTrigger.EnterActions>
                <MultiTrigger.ExitActions>
                  <BeginStoryboard x:Name="DeactivationTimeline_BeginStoryboard" Storyboard="{StaticResource DeactivationTimeline}"/>
                </MultiTrigger.ExitActions>
              </MultiTrigger>
              <Trigger Property="IsEnabled" Value="False">
  							<Setter Property="Background" TargetName="contentBorder">
  								<Setter.Value>
  									<LinearGradientBrush EndPoint="0,0" StartPoint="0,1">
  										<GradientStop Color="#4CA4B4BD" Offset="0"/>
  										<GradientStop Color="#4CDFE9EE" Offset="1"/>
  									</LinearGradientBrush>
  								</Setter.Value>
  							</Setter>
  							<Setter Property="Foreground" Value="#A5333333"/>
  							<Setter Property="BorderBrush" Value="#33000000"/>
  						</Trigger>
  					</ControlTemplate.Triggers>
  				</ControlTemplate>
  			</Setter.Value>
  		</Setter>
  	</Style>
  </s:SurfaceUserControl.Resources>
  <Grid>
    <s:ScatterView>
      <s:ScatterViewItem x:Name="_panelContainer" x:FieldModifier="private" CanScale="False" Width="485" Height="220" Orientation="0" Opacity="0" Visibility="Collapsed" Center="512,384" RenderTransformOrigin="0.5,0.5" Style="{DynamicResource ScatterViewItemStyle}">
        <controls:AdminPanel x:Name="_panel" x:FieldModifier="private" />
      </s:ScatterViewItem>
    </s:ScatterView>
  </Grid>
</s:SurfaceUserControl>