我在列表框中显示歌曲列表我有绑定媒体元素但我无法在songs.cs文件中获取媒体元素名称实例并且无法播放歌曲
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<MediaElement Name="Player" Source="{Binding SongUrl}" AutoPlay="False"/>
<Button Name="Click" Click="Play_Click" Content="Button"/>
<StackPanel Width="150" Height="50">
<TextBlock Text="{Binding SongName}" TextWrapping="Wrap" Style="{StaticResource PhoneTextSubtleStyle}" TextAlignment="Center" Foreground="Red" FontSize="16"/>
</StackPanel>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
Songs.cs 中的示例:
private void Play_Click(object sender, RoutedEventArgs e)
{
Player.play(); (unable to get Media Element name)
}