问题描述
前台:<Gridx:Name="main"><Grid.ColumnDefinitions><ColumnDefinitionWidth="*"/><ColumnDefinitionWidth="*"/><ColumnDefinitionWidth="*"/></Grid.ColumnDefinitions><Grid.RowDefinitions><RowDefinitionHeight="*"/><RowDefinitionHeight="*"/></Grid.RowDefinitions><MediaElementx:Name="me1"Grid.Row="0"Grid.Column="0"/><MediaElementx:Name="me2"Grid.Row="0"Grid.Column="1"/><MediaElementx:Name="me3"Grid.Row="0"Grid.Column="2"/><MediaElementx:Name="me4"Grid.Row="1"Grid.Column="0"/><MediaElementx:Name="me5"Grid.Row="1"Grid.Column="1"/><MediaElementx:Name="me6"Grid.Row="1"Grid.Column="2"/></Grid>后台:privatevoidWindow_Loaded(objectsender,RoutedEventArgse){varaction=newAction(()=>{varsuffix="wmv";varindex=1;foreach(varchildinthis.main.Children){if(childisMediaElement){varmediaElement=childasMediaElement;varuriString=string.Format(@"C:UsersPublicVideosSampleVideos{0}.{1}",index,suffix);varuri=newUri(uriString);mediaElement.Source=uri;index++;}}});this.Dispatcher.BeginInvoke(action);}
解决方案
解决方案二:
这个奇葩问题到底是什么原因。