| Subject: MediaTimeline and Binding |
| Group: microsoft.public.windows.developer.winfx.avalon |
| Date: 4/13/2008 2:37:00 AM |
| From: =?Utf-8?B?U2hheUVy?= [Email Address Protection] |
I'm trying to create a simple Media playlist player using MediaTimeline. In all of the examples that I saw that Source property is hardcoded. When I try to set the Source using binding I get "Must specify URI." error. I'm attaching here a full XAML source that can repro the problem. <Window x:Class="PureXAMLPlayer.Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:sys="clr-namespace:System;assembly=mscorlib" Title="Window1" Height="517" Width="905"> <Grid> <Grid.Resources> <x:ArrayExtension Type="sys:String" x:Key="Data"> <sys:String>C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples\GraphicsMM_Media\MediaGallery\csharp\bin\Debug\media\xbox.wmv</sys:String> <sys:String>C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples\GraphicsMM_Media\MediaGallery\csharp\bin\Debug\media\xbox.wmv</sys:String> <sys:String>C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples\GraphicsMM_Media\MediaGallery\csharp\bin\Debug\media\xbox.wmv</sys:String> <sys:String>C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples\GraphicsMM_Media\MediaGallery\csharp\bin\Debug\media\xbox.wmv</sys:String> <sys:String>C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples\GraphicsMM_Media\MediaGallery\csharp\bin\Debug\media\xbox.wmv</sys:String> <sys:String>C:\Program Files\Microsoft SDKs\Windows\v6.1\Samples\WPFSamples\GraphicsMM_Media\MediaGallery\csharp\bin\Debug\media\xbox.wmv</sys:String> </x:ArrayExtension> </Grid.Resources> <Grid.ColumnDefinitions> <ColumnDefinition Width="146*" /> <ColumnDefinition Width="737*" /> </Grid.ColumnDefinitions> <Grid DataContext="{StaticResource Data}"> <Grid.RowDefinitions> <RowDefinition /> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <ListBox HorizontalAlignment="Left" Width="230" Name="List" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" /> <StackPanel Grid.Row="1"> <Button>Play <Button.Triggers> <EventTrigger RoutedEvent="Button.Click"> <EventTrigger.Actions> <BeginStoryboard Name="myBegin"> <Storyboard> <MediaTimeline Storyboard.TargetName="myMediaElement" > <MediaTimeline.Source> <Binding ElementName="List" Path="SelectedItem.Content"/> </MediaTimeline.Source> </MediaTimeline> </Storyboard> </BeginStoryboard> </EventTrigger.Actions> </EventTrigger> </Button.Triggers> </Button> <Button>Stop</Button> <Button>Pause</Button> </StackPanel> </Grid> <MediaElement Grid.Column="1" Name="myMediaElement" HorizontalAlignment="Right" Width="737" /> </Grid> </Window> |
| Back |