我正在尝试在silverlight5页面中播放.swf。我正在使用ListBox控件或Image Control
或在Silvarlight中播放swf文件的任何想法
<Image Grid.Row="0" Name="bottom_video" Height="80" Source="{Binding VodeoUrl,Mode=OneWay}" Margin="0,20,0,0" />
最佳答案
您可以在下面的代码中看到如何在Silverlight上使用iframe:
<Grid x:Name="LayoutRoot">
<HyperlinkButton Content="HyperlinkButton" Height="23" HorizontalAlignment="Left" Margin="44,20,0,0" Name="hyperlinkButton1" VerticalAlignment="Top" Width="100" TargetName="" Click="hyperlinkButton1_Click" />
</Grid>
code behind:
private void hyperlinkButton1_Click(object sender, RoutedEventArgs e) {
HtmlDocument _document = HtmlPage.Document;
HtmlElement iframe = _document.CreateElement("IFRAME");
iframe.SetAttribute("src", "http://localhost:52878/TestForm.aspx");
iframe.SetStyleAttribute("position", "absolute");
iframe.SetStyleAttribute("top", "100px");
iframe.SetStyleAttribute("left", "200px");
HtmlElement body = (HtmlElement)_document.GetElementsByTagName("BODY")[0];
body.AppendChild(iframe);
HtmlDocument _document = HtmlPage.Document;
HtmlElement iframe = _document.CreateElement("IFRAME");
iframe.SetAttribute("src", "http://localhost:52878/TestForm.aspx");
iframe.SetStyleAttribute("position", "absolute");
iframe.SetStyleAttribute("top", "100px");
iframe.SetStyleAttribute("left", "200px");
HtmlElement body = (HtmlElement)_document.GetElementsByTagName("BODY")[0];
body.AppendChild(iframe);
}