Loading User Information from Channel 9
Something went wrong getting user information from Channel 9
Loading User Information from MSDN
Something went wrong getting user information from MSDN
Loading Visual Studio Achievements
Something went wrong getting the Visual Studio Achievements
WPF 3.5 SP1 App Model with Jennifer Lee
Dec 22, 2008 at 2:09 PMA 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={}<HTML><BODY\>\{0\}\<BODY\>\<HTML\>}"/>