public FrameworkElement CreateWidgetControl(IDiagram widgetViewModel, ContextMenu contextMenu) { var htmlViewer = widgetViewModel as HtmlViewerWidgetViewModel; var ret = new BrowserControl { DataContext = htmlViewer, ContextMenu = contextMenu }; var heightBinding = new Binding("Height") { Source = htmlViewer, Mode = BindingMode.TwoWay }; var widthBinding = new Binding("Width") { Source = htmlViewer, Mode = BindingMode.TwoWay }; var xBinding = new Binding("X") { Source = htmlViewer, Mode = BindingMode.TwoWay }; var yBinding = new Binding("Y") { Source = htmlViewer, Mode = BindingMode.TwoWay }; var transformBinding = new Binding("RenderTransform") { Source = htmlViewer, Mode = BindingMode.OneWay }; var urlBinding = new Binding("Url") { Source = htmlViewer, Mode = BindingMode.TwoWay }; var toolbarVisibleBinding = new Binding("Settings.IsToolbarVisible") { Source = htmlViewer, Mode = BindingMode.TwoWay }; ret.SetBinding(InkCanvas.LeftProperty, xBinding); ret.SetBinding(InkCanvas.TopProperty, yBinding); ret.SetBinding(FrameworkElement.HeightProperty, heightBinding); ret.SetBinding(FrameworkElement.WidthProperty, widthBinding); ret.SetBinding(UIElement.RenderTransformProperty, transformBinding); ret.SetBinding(BrowserControl.ActiveUrlProperty, urlBinding); ret.SetBinding(BrowserControl.IsToolbarVisibleProperty, toolbarVisibleBinding); return(ret); }