Search code examples
c#silverlightsilverlight-4.0silverlight-5.0silverlight-toolkit

How to play swf file in silverlight?


I am tring to play a .swf in silverlight5 page.I am using the ListBox control or Image Control Or Any Idea To Play swf File in Silvarlight

<Image Grid.Row="0" Name="bottom_video" Height="80" Source="{Binding VodeoUrl,Mode=OneWay}" Margin="0,20,0,0" /> 

Solution

  • You can see in the code below how to use Iframe on Silverlight:

    <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);
    
    }