Skip to main content
Home Forums Silverlight Design Designing with Silverlight video as background
8 replies. Latest Post by anton berg on November 9, 2009.
(0)
anton berg
Member
0 points
6 Posts
11-07-2009 9:27 AM |
Hi all ....first time with xaml, I was trying to make a simple site with video as background
I probably started out the wrong way. I was trying to create something like this http://www.julapy.com can you help me?
how do you create it in silverlight?
I wanted to use a bit longer clip but. I obviously don't know where to start please help
Sergey.L...
Contributor
7198 points
1,340 Posts
11-07-2009 10:36 AM |
Hi Anton,
Use VideoBrush for set video as background. Pixel shaders will help you to create an effect in video as at http://www.julapy.com
11-07-2009 3:14 PM |
Hi
I have try´d to use the MediaElement and VideoBrush but i does not play there is nothing i the browser ??
can somebody please help me
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="home.MainPage" Width="720" Height="480">
<Grid x:Name="LayoutRoot" Background="White"> <Canvas Margin="0,0,0,0"/> <MediaElement x:Name="home_wma" Margin="0,0,0,0" Source="/home.wma" Stretch="Fill"> <MediaElement.Resources> <VideoBrush x:Key="home_wma" SourceName="home_wma"/> </MediaElement.Resources> </MediaElement> </Grid></UserControl>
11-07-2009 5:14 PM |
Try this:
<UserControl xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Class="home.MainPage" Width="720" Height="480"> <Grid x:Name="LayoutRoot" Background="White"> <Canvas Margin="0,0,0,0"/> <MediaElement x:Name="meFilm" Source="/home.wma" IsMuted="True" Opacity="0.0" IsHitTestVisible="False"/> <TextBlock x:Name="ContentText" Style="{StaticResource ContentTextStyle}" Text="Home page content" FontFamily="Verdana" FontSize="120" FontWeight="Bold" TextWrapping="Wrap"> <TextBlock.Foreground> <VideoBrush SourceName="meFilm"></VideoBrush> </TextBlock.Foreground> </TextBlock> </Grid> </UserControl>
11-08-2009 2:41 PM |
Thanks Sergey, but can´t make it loop i can only make it play once is there a way to set repeat forever ??
this is all that was needed
<Grid x:Name="LayoutRoot" Background="White"> <MediaElement x:Name="home_wma" Margin="0,0,0,0" Source="/home.wma" Stretch="Fill" d:IsLocked="True"> <MediaElement.Resources> <VideoBrush x:Key="home_wma" SourceName="home_wma"/> </MediaElement.Resources> </MediaElement>
11-08-2009 3:53 PM |
You need to subscribe to CurrentStateChanged event of MediaElement class. Verify a state of video at handler of that event and if it stop call a Play method of MediaElement.
11-08-2009 4:15 PM |
i cant get that to work inside of blend 3. can you give me an exsample ?
11-09-2009 3:35 AM |
- page.xaml:
<MediaElement . . . CurrentStateChanged="MediaElement_CurrentStateChanged">
- page.xaml.cs:
private void MediaElement_CurrentStateChanged(object sender, RoutedEventArgs e) { MediaElement me = (MediaElement)sender; switch (me.CurrentState) { case MediaElementState.Paused: me.Stop(); me.Play(); break; default: break; } }
11-09-2009 11:29 AM |
thanks for all your help sergey ..