Skip to content

Commit

Permalink
WinForms/Wpf.HwndHost - Add CefSharpSettings.RuntimeStyle
Browse files Browse the repository at this point in the history
- Allow for configuring of the CEF RuntimeStyle globally.

Issue #4835
  • Loading branch information
amaitland committed Jun 21, 2024
1 parent 43321f7 commit 6b682d6
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CefSharp.WinForms/ChromiumWebBrowser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ private void OnHandleDestroyedInternal()
protected virtual IWindowInfo CreateBrowserWindowInfo(IntPtr handle)
{
var windowInfo = Core.ObjectFactory.CreateWindowInfo();
windowInfo.RuntimeStyle = CefRuntimeStyle.Alloy;
windowInfo.RuntimeStyle = CefSharpSettings.RuntimeStyle ?? CefRuntimeStyle.Alloy;
windowInfo.SetAsChild(handle);

if (!ActivateBrowserOnCreation)
Expand Down
14 changes: 14 additions & 0 deletions CefSharp/CefSharpSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,19 @@ static CefSharpSettings()
/// false.
/// </summary>
public static bool FocusedNodeChangedEnabled { get; set; }

/// <summary>
/// CefSharp.WinForms and CefSharp.Wpf.HwndHost ONLY!
/// The default is to create <see cref="CefRuntimeStyle.Alloy"/>
/// styled browsers, those wanting to use <see cref="CefRuntimeStyle.Chrome"/>
/// styled browsers can set this property.
/// </summary>
/// <remarks>
/// Sets the <see cref="IWindowInfo.RuntimeStyle"/> property.
/// You can customise this yourself on a per browser basis
/// by overriding the ChromiumWebBrowser.CreateBrowserWindowInfo
/// property.
/// </remarks>
public static CefRuntimeStyle? RuntimeStyle { get; set; }
}
}

0 comments on commit 6b682d6

Please sign in to comment.