我基本上試圖動態/編程創建下面的代碼集,但我不確定如何去做。在網格中動態添加按鈕和Silverlight播放器?
<Grid x:Name="LayoutRoot">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<smf:SMFPlayer x:Name="player" Grid.Row="0" AutoPlay="False">
<smf:SMFPlayer.Playlist>
<media:PlaylistItem
DeliveryMethod="AdaptiveStreaming"
MediaSource="http://video3.smoothhd.com.edgesuite.net/ondemand/Big%20Buck%20Bunny%20Adaptive.ism/Manifest"/>
<media:PlaylistItem
DeliveryMethod="AdaptiveStreaming"
SelectedCaptionStreamName="textstream_eng"
MediaSource="http://streams.smooth.vertigo.com/elephantsdream/Elephants_Dream_1024-h264-st-aac.ism/manifest"/>
</smf:SMFPlayer.Playlist>
</smf:SMFPlayer>
<StackPanel Grid.Row="1" Orientation="Horizontal" Background="Transparent">
<Button x:Name="test1" Height="30" Width="70" Content="Test 1"/>
<Button x:Name="test2" Height="30" Width="70" Content="Test 2"/>
</StackPanel>
</Grid>
這裏是它的外觀靜態: http://i.imgur.com/uz1O8.png
謝謝!
如果我有一個繼承自SMFPlayer的類,是否有任何方法指定我想通過xmlns使用此子類而不是SMFPlayer:...? – Neykho
@Neykho,是的。您需要知道繼承自SMFPlayer的類的名稱空間路徑。然後添加新的xmlns或更改xlmns:smf以使用新路徑。即'xmlns:name =「clr-namespace:TypicalThisIsNameOfYourProject.RestOfTheNamespacePath」' – ShawnFeatherly