MediaElement me1= XamlReader.Load(@"<MediaElement xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' Name='me1' Opacity='0' />") as MediaElement;LayoutRoot.Children.Add(mediaElement);VideoBrush vb = new VideoBrush();vb.SourceName = me1.Name;MyRectangle.Fill=vb;
That code works fine in beta 1, but in beta 2 MyRectangle remains blank!
The clue to fixing this is included in the breaking changes doc:
"XamlReader.Load(string) has been changed to always create an implicit namescope."
MediaElement me1 = XamlReader.Load(@"<MediaElement xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' Name='me1' AutoPlay='False' Opacity='0.0' IsHitTestVisible='False' > <MediaElement.Resources> <VideoBrush Name='vb1' SourceName='me1'/> </MediaElement.Resources> </MediaElement>") as MediaElement;VideoBrush vb = me1.FindName("vb1") as VideoBrush;MyRectangle.Fill=vb; After doing this, MyRectangle once again displays the video
MediaElement me1 = XamlReader.Load(@"<MediaElement xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation' Name='me1' AutoPlay='False' Opacity='0.0' IsHitTestVisible='False' > <MediaElement.Resources> <VideoBrush Name='vb1' SourceName='me1'/> </MediaElement.Resources> </MediaElement>") as MediaElement;VideoBrush vb = me1.FindName("vb1") as VideoBrush;MyRectangle.Fill=vb;
Powered by: newtelligence dasBlog 2.0.7226.0
© Copyright 2010, Sherwin Rice
E-mail