MediaCommands Class Problems

2 posts, 0 answers
  1. fred
    fred avatar
    28 posts
    Member since:
    Jun 2010

    Posted 25 Jun 2010 Link to this post


    Hi,

    When I use the code provided in the MediaCommands example, all is fine : http://demos.telerik.com/silverlight/#MediaPlayer/MediaCommands

    But when I try just to replace a MediaCommand class by another, or just add a new one in my RadButton, such as MediaCommand.Play, I get a system runtime error.

    an unhandled exception ("Unhandled Error in Silverlight Application code : 4004 Category: ManagedRuntimeError Message: System.NullReferenceException: la référence d'objet n'est pas définie à une instance d'objet.

    Here is my code (with the MediaCommand.Play issue: remove it and the whole thing works.. )

    thanks in advance for the help
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Bottom">  
     
                                    <telerik:RadButton Command="telerik:MediaCommands.Play" ToolTipService.ToolTip="Play" 
                                        CommandTarget="{Binding ElementName=player}" Padding="5" Margin="0 3 0 0">  
                                        <telerik:RadButton.Content> 
                                            <Grid Height="10"  Width="10">  
                                                <Path Stretch="Fill" Margin="0,1,0,0" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L6,4 L6,3 L7,3 L7,2 L8,2 L8,1 L9,1 L9,0 L10,0 L10,1 L10,2 L10,3 L10,4 L10,5 L10,6 L10,7 L10,8 L10,9 L9,9 L9,8 L8,8 L8,7 L7,7 L7,6 L6,6 L6,5 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource OuterPath}" /> 
                                                <Path Stretch="Fill" Margin="0,0,0,1"   
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L6,4 L6,3 L7,3 L7,2 L8,2 L8,1 L9,1 L9,0 L10,0 L10,1 L10,2 L10,3 L10,4 L10,5 L10,6 L10,7 L10,8 L10,9 L9,9 L9,8 L8,8 L8,7 L7,7 L7,6 L6,6 L6,5 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource InnerPath}" /> 
                                            </Grid> 
                                        </telerik:RadButton.Content> 
                                    </telerik:RadButton> 
                                      
                                    <telerik:RadButton Command="telerik:MediaCommands.FastForward" ToolTipService.ToolTip="FastForward" 
                                        CommandTarget="{Binding ElementName=player}" CommandParameter="10" Padding="5" Margin="0 3 0 0">  
                                        <telerik:RadButton.Content> 
                                            <Grid Height="10"  Width="10">  
                                                <Path Stretch="Fill" Margin="0,1,0,0" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L6,4 L6,3 L7,3 L7,2 L8,2 L8,1 L9,1 L9,0 L10,0 L10,1 L10,2 L10,3 L10,4 L10,5 L10,6 L10,7 L10,8 L10,9 L9,9 L9,8 L8,8 L8,7 L7,7 L7,6 L6,6 L6,5 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource OuterPath}" /> 
                                                <Path Stretch="Fill" Margin="0,0,0,1"   
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L6,4 L6,3 L7,3 L7,2 L8,2 L8,1 L9,1 L9,0 L10,0 L10,1 L10,2 L10,3 L10,4 L10,5 L10,6 L10,7 L10,8 L10,9 L9,9 L9,8 L8,8 L8,7 L7,7 L7,6 L6,6 L6,5 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource InnerPath}" /> 
                                            </Grid> 
                                        </telerik:RadButton.Content> 
                                    </telerik:RadButton> 
     
                                    <telerik:RadButton Command="telerik:MediaCommands.Rewind" ToolTipService.ToolTip="Rewind" 
                                        CommandTarget="{Binding ElementName=player}" CommandParameter="10" Padding="5" Margin="0 3 0 0">  
                                        <telerik:RadButton.Content> 
                                            <Grid Height="10" Width="10" RenderTransformOrigin="0.5 0.5">  
                                                <Path Stretch="Fill" Margin="0,1,0,0" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L6,4 L6,3 L7,3 L7,2 L8,2 L8,1 L9,1 L9,0 L10,0 L10,1 L10,2 L10,3 L10,4 L10,5 L10,6 L10,7 L10,8 L10,9 L9,9 L9,8 L8,8 L8,7 L7,7 L7,6 L6,6 L6,5 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource OuterPath}" /> 
                                                <Path Stretch="Fill" Margin="0,0,0,1" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L6,4 L6,3 L7,3 L7,2 L8,2 L8,1 L9,1 L9,0 L10,0 L10,1 L10,2 L10,3 L10,4 L10,5 L10,6 L10,7 L10,8 L10,9 L9,9 L9,8 L8,8 L8,7 L7,7 L7,6 L6,6 L6,5 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z"   
                                                    Fill="{StaticResource InnerPath}"/>  
     
                                                <Grid.RenderTransform> 
                                                    <ScaleTransform ScaleX="-1" ScaleY="1" /> 
                                                </Grid.RenderTransform> 
                                            </Grid> 
                                        </telerik:RadButton.Content> 
                                    </telerik:RadButton> 
     
                                    <telerik:RadToggleButton ToolTipService.ToolTip="Pin Chapter" 
                                        Command="telerik:MediaCommands.ToggleChaptersPanelPinned" 
                                        CommandTarget="{Binding ElementName=player}" Padding="5" Margin="0 3 0 0">  
                                        <telerik:RadToggleButton.Content> 
                                            <Grid Height="10"  Width="15">  
                                                <Path Fill="{StaticResource InnerPath}" Stretch="Fill" Margin="0,0,0,1" UseLayoutRounding="False" 
                                                    Data="M12,6 L13,6 L13,7 L12,7 z M8,6 L9,6 L9,7 L8,7 z M1,6 L1,7 L1,8 L2,8 L3,8 L4,8 L4,7 L4,6 L3,6 L2,6 z M9,5 L10,5 L10,6 L9,6 z M0,5 L1,5 L2,5 L3,5 L4,5 L5,5 L6,5 L7,5 L8,5 L8,6 L7,6 L6,6 L5,6 L5,7 L5,8 L6,8 L7,8 L7,7 L8,7 L8,8 L9,8 L10,8 L11,8 L11,7 L12,7 L12,9 L12,9 L11,9 L10,9 L9,9 L8,9 L7,9 L6,9 L5,9 L4,9 L3,9 L2,9 L1,9 L0,9 L0,8 L0,7 L0,6 z M9,3 L10,3 L10,4 L9,4 z M10,2 L11,2 L11,3 L10,3 z M8,2 L9,2 L9,3 L8,3 z M13,1 L14,1 L14,2 L15,2 L15,3 L14,3 L14,4 L13,4 L13,5 L12,5 L12,6 L11,6 L11,5 L10,5 L10,4 L11,4 L11,3 L12,3 L12,2 L13,2 z M11,1 L12,1 L12,2 L11,2 z M12,0 L13,0 L13,1 L12,1 z" /> 
                                                <Rectangle Fill="{StaticResource OuterPath}" Height="1" Margin="0,0,3,0" 
                                                    VerticalAlignment="Bottom" /> 
                                            </Grid> 
                                        </telerik:RadToggleButton.Content> 
                                    </telerik:RadToggleButton> 
     
                                    <telerik:RadToggleButton ToolTipService.ToolTip="Pin Video" 
                                        Command="telerik:MediaCommands.ToggleVideoPanelPinned" 
                                        CommandTarget="{Binding ElementName=player}" Padding="5" Margin="0 3 0 0">  
                                        <telerik:RadToggleButton.Content> 
                                            <Grid Width="15">  
                                                <Path Stretch="Fill" StrokeThickness="0" UseLayoutRounding="False" 
                                                    Data="M5,6 L6,6 L6,7 L7,7 L7,8 L6,8 L6,9 L5,9 L5,8 L5,7. z M12,6 L13,6 L13,7 L12,7 z M8,6 L9,6 L9,7 L8,7 z M9,5 L10,5 L10,6 L9,6 z M0,3 L1,3 L2,3 L3,3 L4,3 L5,3 L6,3 L7,3 L8,3 L8,4 L7,4 L6,4 L5,4 L4,4 L3,4 L2,4 L1,4 L1,5 L1,6 L1,7 L1,8 L1,9 L1,10 L1,11 L2,11 L3,11 L4,11 L5,11 L6,11 L7,11 L8,11 L9,11 L10,11 L11,11 L11,10 L11,9 L11,8 L11,7 L12,7 L12,8 L12,9 L12,10 L12,11 L12,12 L11,12 L10,12 L9,12 L8,12 L7,12 L6,12 L5,12 L4,12 L3,12 L2,12 L1,12 L0,12 L0,11 L0,10 L0,9 L0,8L0,7 L0,6 L0,5 L0,4 z M9,3 L10,3 L10,4 L9,4 z M10,2 L11,2 L11,3 L10,3 z M8,2 L9,2 L9,3 L8,3 z M13,1 L14,1 L14,2 L15,2 L15,3 L14,3 L14,4 L13,4 L13,5 L12,5 L12,6 L11,6 L11,5 L10,5 L10,4 L11,4 L11,3 L12,3 L12,2 L13,2 z M11,1 L12,1 L12,2 L11,2 z M12,0 L13,0 L13,1 L12,1 z" 
                                                    Margin="0,0,0,1" Fill="{StaticResource InnerPath}"/>  
                                                <Rectangle Fill="{StaticResource OuterPath}" StrokeThickness="0" Height="1" Margin="0,12,3,0" /> 
                                            </Grid> 
                                        </telerik:RadToggleButton.Content> 
                                    </telerik:RadToggleButton> 
     
                                    <telerik:RadButton Command="telerik:MediaCommands.PreviousChapter" Margin="0 3 0 0" 
                                        CommandTarget="{Binding ElementName=player}" ToolTipService.ToolTip="Previous Chapter" Padding="5">  
                                        <telerik:RadButton.Content> 
                                            <Grid Height="10" Margin="0" Width="5">  
                                                <Path Stretch="Fill" Margin="0,1,0,0" UseLayoutRounding="False" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource OuterPath}" /> 
                                                <Path Stretch="Fill" Margin="0,0,0,1" UseLayoutRounding="False" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z"   
                                                    Fill="{StaticResource InnerPath}"/>  
                                            </Grid> 
                                        </telerik:RadButton.Content> 
                                    </telerik:RadButton> 
     
                                    <telerik:RadButton  Command="telerik:MediaCommands.NextChapter" ToolTipService.ToolTip="Next Chapter" 
                                        CommandTarget="{Binding ElementName=player}" Padding="5" Margin="0 3 0 0">  
                                        <telerik:RadButton.Content> 
                                            <Grid Height="10" Margin="0" Width="5" RenderTransformOrigin="0.5 0.5">  
                                                <Path Stretch="Fill" Margin="0,1,0,0" UseLayoutRounding="False" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z" 
                                                    Fill="{StaticResource OuterPath}" /> 
                                                <Path Stretch="Fill" Margin="0,0,0,1" UseLayoutRounding="False" 
                                                    Data="M4,0 L5,0 L5,1 L5,2 L5,3 L5,4 L5,5 L5,6 L5,7 L5,8 L5,9 L4,9 L4,8 L3,8 L3,7 L2,7 L2,6 L1,6 L1,5 L0,5 L0,4 L1,4 L1,3 L2,3 L2,2 L3,2 L3,1 L4,1 z"   
                                                    Fill="{StaticResource InnerPath}"/>  
     
                                                <Grid.RenderTransform> 
                                                    <ScaleTransform ScaleX="-1" ScaleY="1" /> 
                                                </Grid.RenderTransform> 
                                            </Grid> 
                                        </telerik:RadButton.Content> 
                                    </telerik:RadButton> 
     
                                </StackPanel> 
  2. Miro Miroslavov
    Admin
    Miro Miroslavov avatar
    588 posts

    Posted 30 Jun 2010 Link to this post

    Hello fred,

    I think the problem here is in the xml namespaces. Because MediaCommands class is in the MediaPlayer assembly, while RadButton is in the Controls assembly. But you are using them with the same namespace prefix. Can you please try with the proper namespace for the MediaCommands.
    Thank you.

    Regards,
    Miro Miroslavov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
Back to Top