This project has moved and is read-only. For the latest updates, please go here.

Using the MediaElement in the TouchablePanel

Jul 2, 2009 at 2:57 PM

Any ideas on using the media element in the touchable panel. When ever I use it it the whole app craches. Is there something special I have to do?


Jul 2, 2009 at 5:38 PM

any more detail about the crash?

Jul 3, 2009 at 8:15 AM

Here's the XAML

<mt:Window x:Class="MultiTouchTest.Window1"
    Title="Window1" Height="1000" Width="1000">
        <!--<ItemsControl ItemsSource="{Binding Photos}">
                <DataTemplate DataType="{x:Type sys:String}">
                    <Image Source="{Binding}"/>

            <TextBlock Text="Testing Touch" FontSize="72" Foreground="White" Background="BlueViolet"/>
            <Image Source="getafix.jpg"/>
            <mt:Button Content="Testing Button" Height="50" Width="50"/>
            <MediaElement Source="Wildlife.wmv" x:Name="Vid2" Height="300" Width="300"/>
            <!--<MediaElement Source="MicrosoftSurfacing_on10.wmv" LoadedBehavior="Play"  />-->

Without the media element it works great with it I get a message box in visual studio saying "There is no source code available for the current location" then when I hit ok i get a visual studio debuggin error saying "ArgumentOutOfRangeException was unhandled" Details of the error are "Must be greater than 0 , parameter width". I tried giving the media element a specific width and height in the hope of rectifying it but no luck. Any ideas. By the way im running this on Windows 7 RC in VS2008 SP1 Team System.



Jul 4, 2009 at 11:14 AM

TouchablePanel has issues with elements that change it's size. MediaElement is loaded initialy with size 0,0 and then resized to match the size of the media. Try to place MediaElement in some container, like border. And give it some fixed size.

Jul 6, 2009 at 11:35 AM

I trie using a border and a stack panel but still not luck. The whole app doesnt crash now but I dont see the video. All the other controls work just fine. Any more advice?

Jul 7, 2009 at 7:05 PM

Have you set fixed size on border?

Jul 8, 2009 at 7:47 AM

I did set the border & the stack panel to a fixed size the first time an still no luck.