void ControlLoaded(object sender, RoutedEventArgs e) { control.Loaded -= ControlLoaded; var session = WebCore.CreateWebSession(baseDirectory, new WebPreferences(true) { WebGL = true, EnableGPUAcceleration = true, SmoothScrolling = true, CustomCSS = @"body { font-family: Segoe UI, sans-serif; font-size:0.8em;} ::-webkit-scrollbar { width: 12px; height: 12px; } ::-webkit-scrollbar-track { background-color: white; } ::-webkit-scrollbar-thumb { background-color: #B9B9B9; } ::-webkit-scrollbar-thumb:hover { background-color: #000000; }" }); markpadDataSource = new MarkpadDataSource(); session.AddDataSource("markpad", markpadDataSource); wb = new WebControl { WebSession = session, UseLayoutRounding = true, HorizontalAlignment = HorizontalAlignment.Stretch, VerticalAlignment = VerticalAlignment.Stretch, Source = new Uri("asset://markpad/MarkpadPreviewRender.html"), }; wb.Loaded += WbLoaded; AwesomiumResourceHandler.Host = this; WebCore.ResourceInterceptor = AwesomiumResourceHandler.ResourceInterceptor; wb.ShowCreatedWebView += AwesomiumResourceHandler.ShowCreatedWebView; LoadHtml(Html); control.Content = wb; }