So, I have a flip view to display the article, and in this flip view I have Media Player from the Microsoft Player Framework . Now I want to have access to this media player from code.
However, every example I found used a FindName on a DataTemplate that WinRT did not see.
I tried
var flipViewItem = this.flipView.ItemContainerGenerator.ContainerFromIndex(flipView.SelectedIndex);
and then use VisualTreeHelper to find Media Player, but flipViewItemalways null.
I tried the data binding the video player, but this leads to the simultaneous playback of all the videos in the elements of the flip presentation.
Can anybody help?
EDIT
So this is my xaml that I use:
<FlipView
x:Name="flipView"
AutomationProperties.AutomationId="ItemsFlipView"
AutomationProperties.Name="Item Details"
TabIndex="1"
Margin="0,127,0,10"
ItemsSource="{Binding Source={StaticResource itemsViewSource}}" Grid.RowSpan="2">
<FlipView.ItemTemplate>
<DataTemplate>
<UserControl Loaded="StartLayoutUpdates" Unloaded="StopLayoutUpdates">
<ScrollViewer x:Name="scrollViewer" Style="{StaticResource HorizontalScrollViewerStyle}" Grid.Row="1">
<common:RichTextColumns x:Name="richTextColumns" Margin="117,0,117,47">
<RichTextBlock x:Name="richTextBlock" Width="560" Style="{StaticResource ItemRichTextStyle}">
<Paragraph>
<Run FontSize="26.667" FontWeight="Light" Text="{Binding Title}"/>
</Paragraph>
<Paragraph LineStackingStrategy="MaxHeight">
<InlineUIContainer>
<Grid Width="560" Height="340" Margin="0,20,0,10">
<Grid.Background>
<ImageBrush ImageSource="{Binding Image}" Stretch="UniformToFill" />
</Grid.Background>
<Image x:Name="OverlayImage" Visibility="{Binding ShowVideo, Converter={StaticResource booleanToVisibilityConverter}}" Source="Assets/play-icon.png"/>
<mmppf:MediaPlayer x:Name="ArticleVideo" Width="560" Height="340" />
</Grid>
</InlineUIContainer>
I tried to attach to the media player:
<mmppf:MediaPlayer x:Name="ArticleVideo" Source="{Binding VideoPath}" Width="560" Height="340" PosterSource="{Binding Image}" AutoPlay="False" />
, - . , System.ComponentModel.PropertyChangedEventHandler.Invoke. - .
, , , . SkyNews Windows 8 , ( -). c:\ProgramFiles\WindowsApps, , xaml , , - . , x: ConnectionId usercontrol , . , x: ConnectionId - , - ?