P
Piotrekk
Hi
My goal is to create storyboard containing text, pictures and video. I
have already displayed text and graphics using DoubleAnimation. My
question is how to insert mediatimeline in such a way that video will
be played at desired time. I have tried to do this in XAML since this
is fairly easier but my problem was that video covered all the
pictures even if it hasn't been played yet.
Here is my C# code:
Rectangle rect = new Rectangle();
rect.Name = "myRectangle";
rect.Width = 300;
rect.Height = 300;
asd.Children.Add(rect);
NameScope.SetNameScope(this, new NameScope());
Image one = new Image();
one.Source = new BitmapImage(new Uri("C:\\users\\pkolodzi\
\DSC03721.1.jpg"));
MediaElement me = new MediaElement();
me.Source = new Uri("C:\\users\\pkolodzi\\movie.avi");
me.Name = "movie1";
MediaTimeline mtl = new MediaTimeline();
mtl.BeginTime =
TimeSpan.Zero.Add(TimeSpan.FromSeconds(2));
this.RegisterName(me.Name, me);
this.RegisterName(rect.Name, rect);
rect.Opacity = 0;
VisualBrush vb = new VisualBrush(one);
vb.Stretch = Stretch.UniformToFill;
rect.Fill = vb;
DoubleAnimation da1 = new DoubleAnimation();
da1.BeginTime = TimeSpan.Zero;
da1.From = 0;
da1.To = 1;
da1.Duration = new Duration(TimeSpan.FromSeconds(1));
Storyboard.SetTargetName(da1, rect.Name);
Storyboard.SetTargetProperty(da1, new
PropertyPath(Image.OpacityProperty));
Storyboard.SetTargetName(mtl, me.Name);
// I guess i have to settarget property here but don't
know which one
Storyboard mySb = new Storyboard();
mySb.Children.Add(da1);
mySb.Children.Add(mtl);
mySb.RepeatBehavior = new RepeatBehavior(10);
mySb.Begin(this);
My goal is to create storyboard containing text, pictures and video. I
have already displayed text and graphics using DoubleAnimation. My
question is how to insert mediatimeline in such a way that video will
be played at desired time. I have tried to do this in XAML since this
is fairly easier but my problem was that video covered all the
pictures even if it hasn't been played yet.
Here is my C# code:
Rectangle rect = new Rectangle();
rect.Name = "myRectangle";
rect.Width = 300;
rect.Height = 300;
asd.Children.Add(rect);
NameScope.SetNameScope(this, new NameScope());
Image one = new Image();
one.Source = new BitmapImage(new Uri("C:\\users\\pkolodzi\
\DSC03721.1.jpg"));
MediaElement me = new MediaElement();
me.Source = new Uri("C:\\users\\pkolodzi\\movie.avi");
me.Name = "movie1";
MediaTimeline mtl = new MediaTimeline();
mtl.BeginTime =
TimeSpan.Zero.Add(TimeSpan.FromSeconds(2));
this.RegisterName(me.Name, me);
this.RegisterName(rect.Name, rect);
rect.Opacity = 0;
VisualBrush vb = new VisualBrush(one);
vb.Stretch = Stretch.UniformToFill;
rect.Fill = vb;
DoubleAnimation da1 = new DoubleAnimation();
da1.BeginTime = TimeSpan.Zero;
da1.From = 0;
da1.To = 1;
da1.Duration = new Duration(TimeSpan.FromSeconds(1));
Storyboard.SetTargetName(da1, rect.Name);
Storyboard.SetTargetProperty(da1, new
PropertyPath(Image.OpacityProperty));
Storyboard.SetTargetName(mtl, me.Name);
// I guess i have to settarget property here but don't
know which one
Storyboard mySb = new Storyboard();
mySb.Children.Add(da1);
mySb.Children.Add(mtl);
mySb.RepeatBehavior = new RepeatBehavior(10);
mySb.Begin(this);