Problem embedding custom control

Ribbon for WPF Forum

Posted 17 years ago by Brad Daszynski
Version: 1.0.0345
I have a button that displays a video that is playing. It plays fine in other applications but does not play in the ribbon control. I see the button fine but no video at all. I am using the following code:

<ribbon:Tab Label="Video" KeyTipAccessText="C">
<ribbon:Group Label="Video Feeds">
<Button Width="80" Height="60" Margin="5,0,0,0">
<Grid Height="50">
<MediaElement Name="myMediaElement1" Volume="0">
<EventTrigger RoutedEvent="MediaElement.Loaded">
<MediaTimeline Source="videos/butterfly.wmv" Storyboard.TargetName="myMediaElement1"
RepeatBehavior="Forever" />

Also, when running the application, if I switch to a different tab then back to the tab that contains this code, the application crashes saying:

"myMediaElement1 name cannot be found in the name scope of System.Windows.Controls.MediaElement"

[Modified at 06/25/2007 06:06 PM]

Comments (4)

Posted 17 years ago by Brad Daszynski
I put the code above into a UserControl and embedded that in the Ribbon control and now the video plays. However, in order to make them play, I have to minimize the ribbon (double click), then maximize it (double click). Do you have an idea as to why this is? If not, how would programmatically minimize/maximize the ribbon? Thanks.
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA
Hi Brad,

We'll look into what the problem is with this in general for you. But in the meantime, Ribbon.IsMinimized is what you were looking for.

Actipro Software Support

Posted 17 years ago by Brad Daszynski
Actually, not just minimizing and un-minimizing. If I switch to another tab, then back to the "video" tab, they play...
Posted 17 years ago by Actipro Software Support - Cleveland, OH, USA

My feeling is that since our ribbon items collections are currently not setting the logical parent chain, this might be the reason for the name not resolving when outside of a UserControl. This is something we are looking into updating soon.

As for the loaded thing, it may also be related but it's probably a better idea to only run the videos when the tab is selected anyhow since otherwise you are eating resources when there is nothing visible. We have a Ribbon.SelectedTabChanged event that you can tie into for this purpose.

Actipro Software Support

The latest build of this product (v24.1.2) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.