Results 1 to 5 of 5

Thread: Can I do the HTML Hosting in Silverlight 4?

  1. #1
    Join Date
    Apr 2010
    Posts
    81

    Can I do the HTML Hosting in Silverlight 4?

    I want to know that can I host HTML in Silverlight 4? My friend told me about it, so I am not sure whether it is possible or not. But I think that you guys must be knowing regarding it. Please provide some detailed notes about the HTML hosting in Silverlight 4, if it is possible. I hope that you guys might have got the clue about what I am looking for.?! So please reply as soon as possible. Any other information related to the topic would be appreciable.

  2. #2
    Join Date
    Mar 2008
    Posts
    433

    Re: Can I do the HTML Hosting in Silverlight 4?

    Silverlight 4 can also display HTML within an application. In previous versions, it was doable by displaying a HTML div over the Silverlight application where we wanted it displayed. Note that the Hosting HTML only works in an application Out Of Browser. Otherwise you will get the result as HTML is disabled. I think you got the point. Many users do this in improper way due to which the error gets generated.

  3. #3
    Join Date
    Feb 2008
    Posts
    137

    Re: Can I do the HTML Hosting in Silverlight 4?

    Control is therefore its appearance, the WebBrowser. Two useful methods:
    • Navigate (url)
    • NavigateToString (html)

    Code:
    < WebBrowser   x : Name = " browser "   Width = " 400 "   Height = " 300 "   / >

  4. #4
    Join Date
    Feb 2008
    Posts
    129

    Re: Can I do the HTML Hosting in Silverlight 4?

    You can write in code behind.
    Code:
    browser.NavigateToString ( " <b>Html host in an application SL</b><br/><p>This is top<p> " ) ;
    Or else
    Code:
    browser.Navigate ( new Uri ( " http://localhost/index.html " , UriKind.Absolute)) ;
    For safety reasons, the WebBrowser control can display the content found in the same domain as the Silverlight application, which includes the same area, the same protocol and port. To display content from another domain can pass through an iframe hosts our page located on our domain.

  5. #5
    Join Date
    Jan 2006
    Posts
    6,878

    Re: Can I do the HTML Hosting in Silverlight 4?

    It is also possible to apply a brush type HTML via HtmlBrush. The following is an example that can help you in understanding this :
    Code:
    < StackPanel   x : Name = " LayoutRoot "   Background = " White " > 
    < WebBrowser   x : Name = " browser "   Source = " youtube.html "   Width = " 300 "   Height = " 300 "   Visibility = " Collapsed "   / > 
    < Rectangle   x : Name = " rect "   Width = " 300 "   Height = " 300 " > 
    < Rectangle . Fill > < HtmlBrush   SourceName = " browser "   / > 
    < / Rectangle . Fill > < / Rectangle > < / StackPanel >
    The trick is that we cool our HtmlBrush via Redraw method.
    Code:
    void MainPage_Loaded ( object sender , RoutedEventArgs e) 
    { 
    DispatcherTimer timer = new DispatcherTimer () ; 
    timer.Interval = TimeSpan.FromMilliseconds ( 100 ) ; 
    timer.Tick + = new EventHandler (timer_Tick) ; 
    timer.Start () ; 
    } 
    void timer_Tick ( object sender , EventArgs e) 
    { 
    if (rect.Fill ! = null ) ((HtmlBrush)rect.Fill).Redraw () ; 
    }

Similar Threads

  1. Replies: 2
    Last Post: 09-08-2010, 09:41 AM
  2. How to insert two Silverlight applications within an HTML page
    By Gokul20 in forum Software Development
    Replies: 5
    Last Post: 07-08-2010, 01:57 AM
  3. What is the approach component HTML in Silverlight?
    By Fragant in forum Windows Software
    Replies: 5
    Last Post: 06-08-2010, 11:19 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,113,851.32403 seconds with 16 queries