如何将数据绑定到自定义传输控件?

时间:2019-01-30 18:55:44

标签: uwp

我创建了一个媒体传输控件。我想将一个List绑定到CustomMediaTransportControls。但是我不知道该怎么做。

public List<PlayInfo> playInfo { get; set; }
public class PlayInfo
{
    public int height { get; set; }
    public int width { get; set; }
    public List<UrlList> urlList { get; set; }
    public string name { get; set; }
    public string type { get; set; }
    public string url { get; set; }
}

我只需要“命名”有关视频质量的名称,例如HD。通过选择清晰度来更改播放视频的质量。

<AppBarButton x:Name='PlayInfoButton'Style='{StaticResource AppBarButtonStyle}'>
               <AppBarButton.Flyout>
                    <Flyout>
                        <ListBox x:Name="PlayInfoListBox" >                        
                            <ListBox.ItemTemplate>
                                 <DataTemplate >
                                     <TextBlock Text="{Binding Path=name}"/>
                                  </DataTemplate>

                             </ListBox.ItemTemplate>

                           </ListBox>
                     </Flyout>
              </AppBarButton.Flyout></AppBarButton>                      

1 个答案:

答案 0 :(得分:0)

 <MediaPlayerElement Name="MainMediaPalyer"
                                AreTransportControlsEnabled="True"
                                AutoPlay="True"
                                DoubleTapped="MainMediaPalyer_DoubleTapped">
                <MediaPlayerElement.TransportControls>
                    <control:CustomMediaTransportControls x:Name="mediaTransportControl"
                                                          Style="{StaticResource MyMediaTransportControls}"
                                                          IsCompact="True"
                                                          IsCompactOverlayEnabled="True"
                                                          IsZoomButtonVisible="false"
                                                          IsCompactOverlayButtonVisible="True"
                                                          IsVolumeButtonVisible="True"
                                                          IsStopButtonVisible="False" 
                                                          />
                </MediaPlayerElement.TransportControls>
            </MediaPlayerElement>