Posted By: Adam Kinney | May 16th, 2008 @ 12:51 AM | 19,057 Views | 22 Comments
I spoke with Jennifer Lee about what's new in the Application Model realm for WPF 3.5 SP1.  Topics include the improved cold start, splash screen and a demonstration of HTML and XBAPs using the new WebBrowser control.

Looking for more than application model? Check out the WPF 3.5 SP1 Overview video
Media Downloads:
Rating:
1
0
RE: Binding to thenew  WebBrowser control

A poor man's workaround for this problem is to create a user control that wraps the WebBrowser and offers the needed dependency properties. Here is a quick example:

XAML Defenition (MyWebBrowser.xaml):

<UserControl x:Class="RSSTest.MyWebBrowser"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Height="Auto" Width="Auto">

    <WebBrowser Name="mWebBrowser">

    </WebBrowser>

</UserControl>

C# code (MyWebBrowser.cs):

public partial class MyWebBrowser

{

    public MyWebBrowser()

    {

        InitializeComponent();

    }

 

    public WebBrowser WebBrowser { get { return mWebBrowser; } }

 

    public static readonly DependencyProperty StringHtmlProperty =

        DependencyProperty.Register("StringHtml", typeof(string), typeof(MyWebBrowser),

        new PropertyMetadata(new PropertyChangedCallback(OnStringHtmlChanged)));

    public string StringHtml

    {

        get { return (string)GetValue(StringHtmlProperty); }

        set { SetValue(StringHtmlProperty, value); }

    }

 

    private static void OnStringHtmlChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

    {

        MyWebBrowser me = (MyWebBrowser)d;

        me.WebBrowser.NavigateToString(me.StringHtml);

    }

 

    public static readonly DependencyProperty UriProperty =

        DependencyProperty.Register("Uri", typeof(Uri), typeof(MyWebBrowser),

        new PropertyMetadata(new PropertyChangedCallback(OnUriChanged)));

    public Uri Uri

    {

        get { return (Uri)GetValue(UriProperty); }

        set { SetValue(UriProperty, value); }

    }

 

    private static void OnUriChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

    {

        MyWebBrowser me = (MyWebBrowser)d;

        me.WebBrowser.Navigate(me.Uri);

    }

}

 

Binding Examples:

<local:MyWebBrowser Uri="{Binding Path=Link}"/>

<local:MyWebBrowser StringHtml ="{Binding Path=HtmlString}"/>

<local:MyWebBrowser StringHtml="{Binding Path=Description, StringFormat={}&lt;HTML>&lt;BODY\>\{0\}\&lt;BODY\>\&lt;HTML\>}"/>

 

Merhaba. mırç Sohbet, ailesi olarak chat, ve muhabbet, ve mirc hizmeti vermekteyiz.Bunun yanında papatya sohbet, mirc indir gibi hizmetlerimizde mevcut.Yorum biraz basit oldu ama neyse. etiketler ;  sohbet, Chat, sohbet odaları, muhabbet, mirc, Papatya Sohbet, mirc indir

Merhaba. tek Sohbet, ailesi olarak chat, ve muhabbet, ve mirc hizmeti vermekteyiz.Bunun yanında papatya sohbet, mirc indir gibi hizmetlerimizde mevcut.Yorum biraz basit oldu ama neyse. etiketler ;  sohbet, Chat, sohbet odaları, muhabbet, mirc, Papatya Sohbet, mirc indir

Microsoft Communities