The performance using the CefSharp implementation for WPF is less than appealing, and such I wanted to switch to the WinForms implementation, to improve performance, as many people praised it and stated that it would make the resizing experience much smoother. As such I removed CefSharp.Wpf from my project and implemented CefSharp.WinForms with the following code.
public MainWindow()
{
InitializeComponent();
InitializeCefAndFirstTab();
}
public void InitializeCefAndFirstTab()
{
CefSettings settings = new CefSettings();
// I have not got any settings defined.
Cef.Initialize(settings);
ChromiumWebBrowser browser = new();
WindowsFormsHost browserControlHost = new()
{ Child = browser };
TabItem tabItem = new()
{
Name = $"ScriptFile{tabsOpen}",
Header = $"Script{tabsOpen}.lua",
Content = browserControlHost
};
browser.LoadUrl(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Monaco\index.html"));
TextEditors.Items.Add(tabItem);
}
However when attempting to resize the window, it lags very badly, in the same way it did when I was using the native WPF implementation of CefSharp. (see here)
A small portion of the lag can be blamed on MaterialDesignInXAML, as that seems to have a very minor effect on performance, however it is very much noticably worse when there is a CefSharp browser control visible.