public WebBrowserEx() { _webBrowser = new WebBrowser(); AddVisualChild(_webBrowser); // Create a binding between the // HwndHostExtensions.CopyBitsBehaviorProperty on the child // WebBrowser and the CopyBitsBehaviorProperty on this object. Binding bindingCopyBitsBehavior = new Binding("CopyBitsBehavior"); bindingCopyBitsBehavior.Source = this; bindingCopyBitsBehavior.Mode = BindingMode.TwoWay; _webBrowser.SetBinding(HwndHostExtensions.CopyBitsBehaviorProperty, bindingCopyBitsBehavior); // Create a binding between the // WebBrowserExtensions.SuppressScriptErrorsProperty on the child // WebBrowser and the SuppressScriptErrorsProperty on this object. Binding bindingSuppressScriptErrors = new Binding("SuppressScriptErrors"); bindingSuppressScriptErrors.Source = this; bindingSuppressScriptErrors.Mode = BindingMode.TwoWay; _webBrowser.SetBinding(WebBrowserExtensions.SuppressScriptErrorsProperty, bindingSuppressScriptErrors); // Create a binding between the // WebBrowserExtensions.SuppressEraseBackgroundProperty on the child // WebBrowser and the SuppressEraseBackgroundProperty on this object. Binding bindingSuppressEraseBackground = new Binding("SuppressEraseBackground"); bindingSuppressEraseBackground.Source = this; bindingSuppressEraseBackground.Mode = BindingMode.TwoWay; _webBrowser.SetBinding(WebBrowserExtensions.SuppressEraseBackgroundProperty, bindingSuppressEraseBackground); }
/// <summary> /// Creates the HTML control. /// </summary> /// <param name="property">The property.</param> /// <returns> /// The control. /// </returns> protected virtual FrameworkElement CreateHtmlControl(PropertyItem property) { var c = new WebBrowser(); c.SetBinding(WebBrowserBehavior.NavigateToStringProperty, property.CreateBinding()); return c; }