Playing Movies and Live Reflection in xaml

Following along with a tutorial I found on contentpresenter.com I found it very easy to create a live reflection of a movie playing.  Blend makes this very trivial!  That's only 37 lines of xaml!

<Window

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    x:Class="MovieReflection.MainWindow"

    Title="MovieReflection" Height="500" Width="700"

    >

  <Window.Background>

    <LinearGradientBrush EndPoint="0.505,0.981" StartPoint="0.505,-0.003">

      <GradientStop Color="#FF000000" Offset="0"/>

      <GradientStop Color="#FFFFFFFF" Offset="1"/>

      <GradientStop Color="#FE6E6E6E" Offset="0.375"/>

      <GradientStop Color="#FE595555" Offset="0.51"/>

      <GradientStop Color="#FE959595" Offset="0.577"/>

    </LinearGradientBrush>

  </Window.Background>

  <Grid HorizontalAlignment="Center" VerticalAlignment="Center">

    <StackPanel Margin="0,40,0,0">

      <Grid x:Name="movie" Width="404" Height="229" Background="#FF2F2E2E">

        <MediaElement Margin="4,4,4,4" Source="movie.avi" />

      </Grid>

      <Rectangle Width="{Binding ElementName=movie, Path=Width}" Height="{Binding ElementName=movie, Path=Height}">

        <Rectangle.Fill>

          <VisualBrush Visual="{Binding ElementName=movie}" />

        </Rectangle.Fill>

        <Rectangle.LayoutTransform>

          <ScaleTransform ScaleY="-0.75" />

        </Rectangle.LayoutTransform>

        <Rectangle.OpacityMask>

          <LinearGradientBrush EndPoint="0.48,0.311" StartPoint="0.48,1.044">

            <GradientStop Color="#66000000" Offset="0"/>

            <GradientStop Color="#00FFFFFF" Offset="1"/>

          </LinearGradientBrush>

        </Rectangle.OpacityMask>

      </Rectangle>

    </StackPanel>

  </Grid>

</Window>

Published Sunday, April 15, 2007 7:04 PM by Joe
Filed under: ,

Comments

# re: Playing Movies and Live Reflection in xaml

Monday, April 16, 2007 7:56 AM by Thomas Holloway

Nice, reflection is always a neat trick in wpf.

# re: How to place movies made with xaml in a website????

Monday, April 16, 2007 12:24 PM by gaby

Hi!!! i see you are doing very good examples with xaml code. The interfaces are great, I will like to know how can I use the xaml code in a website made in asp.net.

Before I have used flash and with Flash applet i could see grate animations, but know I will like to use this technology..

how can i do it??

I will appreciate your answer..

# re: Playing Movies and Live Reflection in xaml

Tuesday, April 17, 2007 7:28 AM by Joe

Gaby,

I haven't played with it much yet, though what you want to use is WPF/e (now known as Silverlight).  If I have time this weekend I can post a sample.

http://msdn.microsoft.com/silverlight

Joe

# re: Playing Movies and Live Reflection in xaml

Thursday, April 19, 2007 12:50 AM by Thomas Holloway

As a general point of reference. Channel 9 has a really great set of quickstarts for using WPF/E (Silverlight).

http://channel9.msdn.com/go/wpfe/quickstarts/

# re: Playing Movies and Live Reflection in xaml

Thursday, April 19, 2007 8:53 AM by Joe

Excellent reference, thanks Thomas.

# SilverLight Reflection

Sunday, April 29, 2007 1:45 PM by Microsoft SilverLight

SilverLight Reflection

Powered by Community Server (Non-Commercial Edition), by Telligent Systems