CefSharp.Wpf
ChromiumWebBrowser is the WPF web browser control
Used as workaround for issue https://github.com/cefsharp/CefSharp/issues/3021
The browser initialized - boolean represented as 0 (false) and 1(true) as we use Interlocker to increment/reset
A flag that indicates if you can execute javascript in the main frame.
Flag is set to true in IRenderProcessMessageHandler.OnContextCreated.
and false in IRenderProcessMessageHandler.OnContextReleased
Implement and assign to handle dialog events.
The dialog handler.
Implement and assign to handle events related to JavaScript Dialogs.
The js dialog handler.
Implement and assign to handle events related to key press.
The keyboard handler.
Implement and assign to handle events related to browser requests.
The request handler.
Implement and assign to handle events related to downloading files.
The download handler.
Implement and assign to handle events related to browser load status.
The load handler.
Implement and assign to handle events related to popups.
The life span handler.
Implement and assign to handle events related to browser display state.
The display handler.
Implement and assign to handle events related to the browser context menu
The menu handler.
Implement and assign to handle messages from the render process.
The render process message handler.
Implement to handle events related to find results.
The find handler.
Implement to handle audio events.
The for this ChromiumWebBrowser.
The focus handler.
If you need customized focus handling behavior for WinForms, the suggested
best practice would be to inherit from DefaultFocusHandler and try to avoid
needing to override the logic in OnGotFocus. The implementation in
DefaultFocusHandler relies on very detailed behavior of how WinForms and
Windows interact during window activation.
Implement and assign to handle events related to dragging.
The drag handler.
Implement and control the loading of resources
The resource handler factory.
Event handler that will get called when the resource load for a navigation fails or is canceled.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event handler that will get called when the browser begins loading a frame. Multiple frames may be loading at the same
time. Sub-frames may start or continue loading after the main frame load has ended. This method may not be called for a
particular frame if the load request for that frame fails. For notification of overall browser load status use
OnLoadingStateChange instead.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Whilst this may seem like a logical place to execute js, it's called before the DOM has been loaded, implement
as it's called when the underlying V8Context is created
Event handler that will get called when the browser is done loading a frame. Multiple frames may be loading at the same
time. Sub-frames may start or continue loading after the main frame load has ended. This method will always be called
for all frames irrespective of whether the request completes successfully.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event handler that will get called when the Loading state has changed.
This event will be fired twice. Once when loading is initiated either programmatically or
by user action, and once when loading is terminated due to completion, cancellation of failure.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
Event handler for receiving Javascript console messages being sent from web pages.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang..
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
(The exception to this is when you're running with settings.MultiThreadedMessageLoop = false, then they'll be the same thread).
Event handler for changes to the status message.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI
thread. It is unwise to block on this thread for any length of time as your browser will become unresponsive and/or hang.
To access UI elements you'll need to Invoke/Dispatch onto the UI Thread.
(The exception to this is when you're running with settings.MultiThreadedMessageLoop = false, then they'll be the same thread).
Event handler that will get called when the message that originates from CefSharp.PostMessage
A flag that indicates whether the WebBrowser is initialized (true) or not (false).
true if this instance is browser initialized; otherwise, false.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Handles the event.
The instance containing the event data.
Gets or sets a value indicating whether this instance has parent.
true if this instance has parent; otherwise, false.
Gets the browser adapter.
The browser adapter.
Check is browser is initialized
true if browser is initialized
Throw exception if browser not initialized.
Thrown when an exception error condition occurs.
Throw exception if disposed.
Thrown when a supplied object has been disposed.
TemplatePart Name constant for the Image used to represent the browser
TemplatePart Name constant for the Image used to represent the popup
overlayed on the browser
View Rectangle used by
Store the previous window state, used to determine if the
Windows was previous
and resume rendering
The source
The HwndSource RootVisual (Window) - We store a reference
to unsubscribe event handlers
The MonitorInfo based on the current hwnd
The tooltip timer
The tool tip
The managed cef browser adapter
The ignore URI change
Initial address
Has the underlying Cef Browser been created (slightly different to initialized in that
the browser is initialized in an async fashion)
The image that represents this browser instances
The popup image
The browser
Location of the control on the screen, relative to Top/Left
Used to calculate GetScreenPoint
We're unable to call PointToScreen directly due to treading restrictions
and calling in a sync fashion on the UI thread was problematic.
Browser initialization settings
The request context (we deliberately use a private variable so we can throw an exception if
user attempts to set after browser created)
Keep a short term copy of IDragData, so when calling DoDragDrop, DragEnter is called,
we can reuse the drag data provided from CEF
Keep the current drag&drop effects to return the appropriate effects on drag over.
A flag that indicates whether or not the designer is active
NOTE: Needs to be static for OnApplicationExit
The value for disposal, if it's 1 (one) then this instance is either disposed
or in the process of getting disposed
Hack to work around issue https://github.com/cefsharp/CefSharp/issues/2779
Enabled by default
Number of miliseconds to wait after resizing the browser when it first
becomes visible. After the delay the browser will revert to it's
original size.
Hack to work around issue https://github.com/cefsharp/CefSharp/issues/2779
Gets a value indicating whether this instance is disposed.
if this instance is disposed; otherwise, .
WPF Keyboard Handled forwards key events to the underlying browser
Gets or sets the browser settings.
The browser settings.
Gets or sets the request context.
The request context.
Implement and control how the control is rendered
The render Handler.
Implement to handle events related to accessibility.
The accessibility handler.
Raised every time is called. You can access the underlying buffer, though it's
preferable to either override or implement your own as there is no outwardly
accessible locking (locking is done within the default implementations).
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI thread
Raised every time is called.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI thread
Navigates to the previous page in the browser history. Will automatically be enabled/disabled depending on the
browser state.
The back command.
Navigates to the next page in the browser history. Will automatically be enabled/disabled depending on the
browser state.
The forward command.
Reloads the content of the current page. Will automatically be enabled/disabled depending on the browser state.
The reload command.
Prints the current browser contents.
The print command.
Increases the zoom level.
The zoom in command.
Decreases the zoom level.
The zoom out command.
Resets the zoom level to the default. (100%)
The zoom reset command.
Opens up a new program window (using the default text editor) where the source code of the currently displayed web
page is shown.
The view source command.
Command which cleans up the Resources used by the ChromiumWebBrowser
The cleanup command.
Stops loading the current page.
The stop command.
Cut selected text to the clipboard.
The cut command.
Copy selected text to the clipboard.
The copy command.
Paste text from the clipboard.
The paste command.
Select all text.
The select all command.
Undo last action.
The undo command.
Redo last action.
The redo command.
The dpi scale factor, if the browser has already been initialized
you must manually call IBrowserHost.NotifyScreenInfoChanged for the
browser to be notified of the change.
Initializes static members of the class.
Handles Dispatcher Shutdown
sender
eventargs
Handles the event.
The sender.
The instance containing the event data.
Required for designer support - this method cannot be inlined as the designer
will attempt to load libcef.dll and will subsequently throw an exception.
Required for designer support - this method cannot be inlined as the designer
will attempt to load libcef.dll and will subsequently throw an exception.
Initializes a new instance of the class.
Cef::Initialize() failed
Initializes a new instance of the class.
Use this constructor to load the browser before it's attached to the Visual Tree.
The underlying CefBrowser will be created with the specified .
CEF requires positive values for and ,
if values less than 1 are specified then the default value of 1 will be used instead.
You can subscribe to the event and attach the browser
to its parent control when Loading is complete ( is false).
HwndSource for the Window that will host the browser.
address to be loaded when the browser is created.
size
//Obtain Hwnd from parent window
var hwndSource = (HwndSource)PresentationSource.FromVisual(this);
var browser = new ChromiumWebBrowser(hwndSource, "github.com", 1024, 768);
browser.LoadingStateChanged += OnBrowserLoadingStateChanged;
private void OnBrowserLoadingStateChanged(object sender, LoadingStateChangedEventArgs e)
{
if (e.IsLoading == false)
{
var b = (ChromiumWebBrowser)sender;
b.LoadingStateChanged -= OnBrowserLoadingStateChanged;
Dispatcher.InvokeAsync(() =>
{
//Attach to visual tree
ParentControl.Child = b;
});
}
}
Initializes a new instance of the class.
The specified will be loaded initially.
Use this constructor if you are loading a Chrome Extension.
address to be loaded when the browser is created.
Constructor logic has been moved into this method
Required for designer support - this method cannot be inlined as the designer
will attempt to load libcef.dll and will subsequently throw an exception.
Finalizes an instance of the class.
Releases all resources used by the object
If not in design mode; Releases unmanaged and - optionally - managed resources for the
to release both managed and unmanaged resources; to release only unmanaged resources.
Releases unmanaged and - optionally - managed resources for the
to release both managed and unmanaged resources; to release only unmanaged resources.
This method cannot be inlined as the designer will attempt to load libcef.dll and will subsequently throw an exception.
Gets the ScreenInfo - currently used to get the DPI scale factor.
ScreenInfo containing the current DPI scale factor
Gets the ScreenInfo - currently used to get the DPI scale factor.
ScreenInfo containing the current DPI scale factor
Called to retrieve the view rectangle which is relative to screen coordinates.
This method must always provide a non-empty rectangle.
View Rectangle
Called to retrieve the view rectangle which is relative to screen coordinates.
This method must always provide a non-empty rectangle.
View Rectangle
Called when the user starts dragging content in the web view.
OS APIs that run a system message loop may be used within the StartDragging call.
Don't call any of IBrowserHost::DragSource*Ended* methods after returning false.
Call IBrowserHost.DragSourceEndedAt and DragSourceSystemDragEnded either synchronously or asynchronously to inform the web view that the drag operation has ended.
Contextual information about the dragged content
allowed operations
is the drag start location in screen coordinates
is the drag start location in screen coordinates
Return true to handle the drag operation.
Called when the web view wants to update the mouse cursor during a drag & drop operation.
describes the allowed operation (none, move, copy, link).
Called when an element has been rendered to the shared texture handle.
This method is only called when is set to true
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
is the handle for a D3D11 Texture2D that can be accessed via ID3D11Device using the OpenSharedResource method.
Called when an element has been rendered to the shared texture handle.
This method is only called when is set to true
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
is the handle for a D3D11 Texture2D that can be accessed via ID3D11Device using the OpenSharedResource method.
Called when an element should be painted.
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
The bitmap will be will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin
width
height
Called when an element should be painted. Pixel values passed to this method are scaled relative to view coordinates based on the
value of returned from . To override the default behaviour
override this method or implement your own and assign to
Called on the CEF UI Thread
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
The bitmap will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin.
The buffer should no be used outside the scope of this method, a copy should be taken. As the buffer is reused
internally and potentially even freed.
width
height
Sets the popup size and position.
The popup rectangle (size and position).
Sets the popup is open.
if set to true [is open].
Sets the cursor.
The handle.
The type.
custom cursor information
Called when the IME composition range has changed.
is the range of characters that have been selected
is the bounds of each character in view coordinates.
Called when an on-screen keyboard should be shown or hidden for the specified browser.
the browser
specifies what kind of keyboard should be opened. If , any existing keyboard for this browser should be hidden.
Sets the address.
The instance containing the event data.
Sets the loading state change.
The instance containing the event data.
Sets the title.
The instance containing the event data.
Sets the tooltip text.
The tooltip text.
Called when [after browser created].
The browser.
A flag that indicates whether the state of the control current supports the GoBack action (true) or not (false).
true if this instance can go back; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
The can go back property
A flag that indicates whether the state of the control currently supports the GoForward action (true) or not (false).
true if this instance can go forward; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
The can go forward property
The address (URL) which the browser control is currently displaying.
Will automatically be updated as the user navigates to another page (e.g. by clicking on a link).
The address.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
The address property
Event called when the browser address has changed
Handles the event.
The sender.
The instance containing the event data.
Called when [address changed].
The old value.
The new value.
A flag that indicates whether the control is currently loading one or more web pages (true) or not (false).
true if this instance is loading; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
The is loading property
A flag that indicates whether the WebBrowser is initialized (true) or not (false).
true if this instance is browser initialized; otherwise, false.
In the WPF control, this property is implemented as a Dependency Property and fully supports data
binding.
The is browser initialized property
Event called after the underlying CEF browser instance has been created.
Handles the event.
The d.
The instance containing the event data.
Called when [is browser initialized changed].
if set to true [old value].
if set to true [new value].
The title of the web page being currently displayed.
The title.
This property is implemented as a Dependency Property and fully supports data binding.
The title property
Event handler that will get called when the browser title changes
Handles the event.
The d.
The instance containing the event data.
The zoom level at which the browser control is currently displaying.
Can be set to 0 to clear the zoom level (resets to default zoom level).
NOTE: For browsers that share the same render process (same origin) this
property is only updated when the browser changes its visible state.
If you have two browsers visible at the same time that share the same render
process then zooming one will not update this property in the other (unless
the control is hidden and then shown). You can isolate browser instances
using a , they will then have their own render process
regardless of the process policy. You can manually get the Zoom level using
The zoom level.
The zoom level property
Handles the event.
The sender.
The instance containing the event data.
Called when [zoom level changed].
The old value.
The new value.
Specifies the amount used to increase/decrease to ZoomLevel by
By Default this value is 0.10
The zoom level increment.
The zoom level increment property
The CleanupElement Controls when the BrowserResources will be cleaned up.
The ChromiumWebBrowser will register on Unloaded of the provided Element and dispose all resources when that handler is called.
By default the cleanup element is the Window that contains the ChromiumWebBrowser.
if you want cleanup to happen earlier provide another FrameworkElement.
Be aware that this Control is not usable anymore after cleanup is done.
The cleanup element.
The cleanup element property
Handles the event.
The sender.
The instance containing the event data.
Called when [cleanup element changed].
The old value.
The new value.
Handles the event.
The sender.
The instance containing the event data.
The text that will be displayed as a ToolTip
The tooltip text.
The tooltip text property
Called when [tooltip text changed].
Gets or sets the WebBrowser.
The WebBrowser.
The WebBrowser property
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
PresentationSource changed handler.
The sender.
The instance containing the event data.
Called when the Window Location Changes, the PresentationSource changes
and the page loads. We manually track the position as CEF makes calls
on a non-UI thread and calling Invoke in IRenderWebBrowser.GetScreenPoint
makes it very easy to deadlock the browser.
Returns screen coordinates of the browsers location
Create the underlying CefBrowser instance with the specified .
This method should only be used in instances where you need the browser
to load before it's attached to the Visual Tree.
HwndSource for the Window that will host the browser.
initial size
Returns false if browser already created, otherwise true.
Create the underlying Browser instance, can be overriden to defer control creation
The browser will only be created when size > Size(0,0). If you specify a positive
size then the browser will be created, if the ActualWidth and ActualHeight
properties are in reality still 0 then you'll likely end up with a browser that
won't render.
size of the current control, must be greater than Size(0, 0)
bool to indicate if browser was created. If the browser has already been created then this will return false.
Override this method to handle creation of WindowInfo. This method can be used to customise aspects of
browser creation including configuration of settings such as
(used for D3D11 shared texture rendering).
Window handle for the HwndSource
Window Info
Runs the specific Action on the Dispatcher in an async fashion
The action.
The priority.
Runs the specific Action on the Dispatcher in an sync fashion
The action.
The priority.
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
When overridden in a derived class, is invoked whenever application code or internal processes call
.
Converts a .NET Drag event to a CefSharp MouseEvent
The instance containing the event data.
MouseEvent.
Sets the popup size and position implementation.
The popup rectangle (size and position).
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Updates the tooltip.
The text.
Handles the event.
The sender.
The instance containing the event data.
Handles the event.
The sender.
The instance containing the event data.
Invoked when an unhandled attached event reaches an
element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Invoked when an unhandled attached event reaches an
element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Handles the event.
The instance containing the event data.
Invoked when an unhandled attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Invoked when an unhandled attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Invoked when an unhandled attached event reaches an
element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
This event data reports details about the mouse button that was pressed and the handled state.
Invoked when an unhandled routed event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data. The event data reports that the mouse button was released.
Invoked when an unhandled attached event is raised on this element. Implement this method to add class handling for this event.
The that contains the event data.
Invoked when an unhandled attached event reaches an element in
its route that is derived from this class. Implement this method to add class handling for this event.
The that contains event data.
Handles the event.
The instance containing the event data.
Provides class handling for the routed event that occurs when a touch presses inside this element.
The that contains the event data.
Provides class handling for the routed event that occurs when a touch moves while inside this element.
The that contains the event data.
Provides class handling for the routed event that occurs when a touch is released inside this element.
The that contains the event data.
Handles a event.
The instance containing the event data.
Loads the specified URL.
The URL to be loaded.
Zooms the browser in.
Zooms the browser out.
Reset the browser's zoom level to default.
Manually notify the browser the DPI of the parent window has changed.
new DPI
.Net 4.6.2 adds HwndSource.DpiChanged which could be used to automatically
handle DPI change, unfortunately we still target .Net 4.5.2
Legacy keyboard handler uses WindowProc callback interceptor to forward keypress events
the the browser. Use this method to revert to the previous keyboard handling behaviour
The javascript object repository, one repository per ChromiumWebBrowser instance.
Returns the current IBrowser Instance
browser instance or null
Initialization settings. Many of these and other settings can also configured
using command-line switches.
Intialize with default values
Provides a limited read-only Accessibility Handler implementation.
To enable accessibility support use the --force-renderer-accessibility to enable
for all browsers or call
on a per browser basis to enable. By default accessibility is disabled by default.
Having accessibility enabled can impact performance until accessibility is disabled.
Called after renderer process sends accessibility location changes to the browser process.
Updated location info.
Called after renderer process sends accessibility tree changes to the browser process.
Updated tree info.
Default TabControl's AutomationPeer doesn’t know anything about the controls within it, since they’re loaded dynamically.
The purpose of this class is to fix this behavior.
Taken from https://www.colinsalmcorner.com/post/genericautomationpeer--helping-the-coded-ui-framework-find-your-custom-controls
An Experimental ChromiumWebBrowser implementation that includes support for Stylus
using the default WPF touch implementation. There are known performance problems with
this default implementation, workarounds such as https://github.com/jaytwo/WmTouchDevice
may need to be considered. .Net 4.7 supports the newer WM_Pointer implementation which
should resolve the issue see https://github.com/dotnet/docs/blob/master/docs/framework/migration-guide/mitigation-pointer-based-touch-and-stylus-support.md
Original PR https://github.com/cefsharp/CefSharp/pull/2745
Original Author https://github.com/GSonofNun
Touch support was merged into ChromiumWebBrowser, only Style support still exists in this class
Invoked when an unhandled attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Invoked when an unhandled attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Invoked when an unhandled attached event reaches an element in its route that is derived from this class. Implement this method to add class handling for this event.
The that contains the event data.
Handles a event.
The instance containing the event data.
The event type
A WPF Keyboard handler implementation that supports IME
Constructor.
The owner.
Change composition range.
The selection range.
The character bounds.
Setup the Ime Keyboard Handler specific hooks and events
HwndSource.
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Cancel composition.
The hwnd.
Converts .NET drag drop effects to CEF Drag Operations
The drag drop effects.
DragOperationsMask.
Gets the drag effects.
The mask.
DragDropEffects.
ImeHandler provides implementation when message WM_IME_COMPOSITION is received.
MonitorInfo is a wrapper class around MonitorFromWindow and GetMonitorInfo
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-monitorfromwindow
https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getmonitorinfoa
Gets monitor information for the provided window handle
window handle
monitor info
The size, in bytes, of the structure. Set this member to sizeof(MONITORINFOEX) (72) before calling the GetMonitorInfo function.
Doing so lets the function determine the type of structure you are passing to it.
A RECT structure that specifies the display monitor rectangle, expressed in virtual-screen coordinates.
Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values.
A RECT structure that specifies the work area rectangle of the display monitor that can be used by applications,
expressed in virtual-screen coordinates. Windows uses this rectangle to maximize an application on the monitor.
The rest of the area in rcMonitor contains system windows such as the task bar and side bars.
Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values.
The attributes of the display monitor.
This member can be the following value:
1 : MONITORINFOF_PRIMARY
A string that specifies the device name of the monitor being used. Most applications have no use for a display monitor name,
and so can save some bytes by using a MONITORINFO structure.
The RECT structure defines the coordinates of the upper-left and lower-right corners of a rectangle.
By convention, the right and bottom edges of the rectangle are normally considered exclusive.
In other words, the pixel whose coordinates are ( right, bottom ) lies immediately outside of the the rectangle.
For example, when RECT is passed to the FillRect function, the rectangle is filled up to, but not including,
the right column and bottom row of pixels. This structure is identical to the RECTL structure.
The x-coordinate of the upper-left corner of the rectangle.
The y-coordinate of the upper-left corner of the rectangle.
The x-coordinate of the lower-right corner of the rectangle.
The y-coordinate of the lower-right corner of the rectangle.
The owner browser instance
Enumeration for virtual keys taken from http://www.pinvoke.net/default.aspx/Enums/VirtualKeys.html
The source hook
The source
The owner browser instance
WindowProc callback interceptor. Handles Windows messages intended for the source hWnd, and passes them to the
contained browser as needed.
The source handle.
The message.
Additional message info.
Even more message info.
if set to true, the event has already been handled by someone else.
IntPtr.
Internal WpfExtension methods - unlikely you'd need to use these,
they're left public on the off chance you do.
Gets the modifiers.
The instance containing the event data.
CefEventFlags.
Gets keyboard modifiers.
CefEventFlags.
Gets the modifiers.
The instance containing the event data.
CefEventFlags.
Gets the drag data wrapper.
The instance containing the event data.
CefDragDataWrapper.
Gets the link.
The data.
System.String.
Reads a URL using a particular text encoding from drag-and-drop data.
The drag-and-drop data.
The data format name of the URL type.
The text encoding of the URL type.
A URL, or if does not contain a URL
of the correct type.
Implement this interface to control how keys are forwarded to the browser
DelegateCommand
The command handler
The can execute handler
Occurs when changes occur that affect whether or not the command should execute.
Initializes a new instance of the class.
The command handler.
The can execute handler.
Defines the method to be called when the command is invoked.
Data used by the command. If the command does not require data to be passed, this object can be set to null.
Defines the method that determines whether the command can execute in its current state.
Data used by the command. If the command does not require data to be passed, this object can be set to null.
true if this command can be executed; otherwise, false.
Raises the can execute changed.
Implement this interface to handle Offscreen Rendering (OSR).
NOTE: Currently only OnPaint is implemented, at some point expand the API to include all
of CefRenderHandler methods http://magpcss.org/ceforum/apidocs3/projects/(default)/CefRenderHandler.html
Called when an element has been rendered to the shared texture handle.
This method is only called when is set to true
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
is the handle for a D3D11 Texture2D that can be accessed via ID3D11Device using the OpenSharedResource method.
Called when an element should be painted. (Invoked from CefRenderHandler.OnPaint)
This method is only called when is set to false.
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
The bitmap will be will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin
width
height
image used as parent for rendered bitmap
WPF specific implementation, has reference to some of the commands
and properties the exposes.
Navigates to the previous page in the browser history. Will automatically be enabled/disabled depending on the
browser state.
The back command.
Navigates to the next page in the browser history. Will automatically be enabled/disabled depending on the
browser state.
The forward command.
Reloads the content of the current page. Will automatically be enabled/disabled depending on the browser state.
The reload command.
Prints the current browser contents.
The print command.
Increases the zoom level.
The zoom in command.
Decreases the zoom level.
The zoom out command.
Resets the zoom level to the default. (100%)
The zoom reset command.
Opens up a new program window (using the default text editor) where the source code of the currently displayed web
page is shown.
The view source command.
Command which cleans up the Resources used by the ChromiumWebBrowser
The cleanup command.
Stops loading the current page.
The stop command.
Cut selected text to the clipboard.
The cut command.
Copy selected text to the clipboard.
The copy command.
Paste text from the clipboard.
The paste command.
Select all text.
The select all command.
Undo last action.
The undo command.
Redo last action.
The redo command.
Gets the associated with this instance.
The dispatcher.
The zoom level at which the browser control is currently displaying.
Can be set to 0 to clear the zoom level (resets to default zoom level).
The zoom level.
The increment at which the property will be incremented/decremented.
The zoom level increment.
The title of the web page being currently displayed.
The title.
This property is implemented as a Dependency Property and fully supports data binding.
Raised every time is called. You can access the underlying buffer, though it's
preferable to either override or implement your own as there is no outwardly
accessible locking (locking is done within the default implementations).
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI thread
Raised every time is called.
It's important to note this event is fired on a CEF UI thread, which by default is not the same as your application UI thread
Event arguments for the Paint event handler.
Is the OnPaint call for a Popup or the Main View
contains the set of rectangles in pixel coordinates that need to be repainted
Pointer to the unmanaged buffer that holds the bitmap.
The buffer shouldn't be accessed outside the scope of event.
A copy should be taken as the buffer is reused internally and may potentialy be freed.
The bitmap will be width * height * 4 bytes in size and represents a BGRA image with an upper-left origin
Width
Height
Gets or sets a value indicating whether the event is handled.
Initializes a new instance of the class.
is popup
direct rectangle
buffer
width
height
Implements the basics of a
The value for disposal, if it's 1 (one) then this instance is either disposed
or in the process of getting disposed
Gets a value indicating whether this instance is disposed.
if this instance is disposed; otherwise, .
Releases all resources used by the object
Releases unmanaged and - optionally - managed resources for the
to release both managed and unmanaged resources; to release only unmanaged resources.
Called when an element has been rendered to the shared texture handle.
This method is only called when is set to true
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
is the handle for a D3D11 Texture2D that can be accessed via ID3D11Device using the OpenSharedResource method.
Called when an element should be painted. (Invoked from CefRenderHandler.OnPaint)
This method is only called when is set to false.
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
The bitmap will be will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin
width
height
image used as parent for rendered bitmap
AllocHGlobalWritableBitmapRenderHandler - creates/updates an WritableBitmap
Uses to allocate memory for
double buffering when the size matches or creates a new WritableBitmap
when required.
The value for disposal, if it's 1 (one) then this instance is either disposed
or in the process of getting disposed
Initializes a new instance of the class.
The dpi x.
The dpi y.
if true then only the direct rectangle will be updated, otherwise the whole bitmap will be redrawn
priority at which the bitmap will be updated on the UI thread
Gets a value indicating whether this instance is disposed.
if this instance is disposed; otherwise, .
Releases all resources used by the object
Releases unmanaged and - optionally - managed resources for the
to release both managed and unmanaged resources; to release only unmanaged resources.
Details of the bitmap to be rendered
RenderHandler implemenetation that updates the image/bitmap in the
event.
Initially based on https://github.com/cefsharp/CefSharp/issues/2888#issuecomment-528864931
Details of the bitmap to be rendered
ByteArrayWritableBitmapRenderHandler - creates/updates an WritableBitmap
For each OnPaint call a new byte[] is created and then updated. No locking is
performed and memory is allocated for every OnPaint call, so will be very expensive memory
wise.
Initializes a new instance of the class.
The dpi x.
The dpi y.
if true then only the direct rectangle will be updated, otherwise the whole bitmap will be redrawn
priority at which the bitmap will be updated on the UI thread
Called when an element has been rendered to the shared texture handle.
This method is only called when is set to true
indicates whether the element is the view or the popup widget.
contains the set of rectangles in pixel coordinates that need to be repainted
is the handle for a D3D11 Texture2D that can be accessed via ID3D11Device using the OpenSharedResource method.
DirectWritableBitmapRenderHandler - directly copyies the buffer
into writeableBitmap.BackBuffer. No additional copies or locking are used.
Can only be used when CEF UI thread and WPF UI thread are the same (MultiThreadedMessageLoop = false)
Initializes a new instance of the class.
The dpi x.
The dpi y.
if true then only the direct rectangle will be updated, otherwise the whole bitmap will be redrawn
priority at which the bitmap will be updated on the UI thread
InteropBitmapRenderHandler - creates/updates an InteropBitmap
Uses a MemoryMappedFile for double buffering when the size matches
or creates a new InteropBitmap when required
Initializes a new instance of the class.
priority at which the bitmap will be updated on the UI thread
WritableBitmapRenderHandler - creates/updates an WritableBitmap
Uses a MemoryMappedFile for double buffering when the size matches
or creates a new WritableBitmap when required
Initializes a new instance of the class.
The dpi x.
The dpi y.
if true then only the direct rectangle will be updated, otherwise the whole bitmap will be redrawn
priority at which the bitmap will be updated on the UI thread
Event arguments for the VirtualKeyboardRequested Event.
Input mode of a virtual keyboard. When
the keyboard should be hidden
Browser
Initializes a new instance of the class.
browser
input mode
Windows Message Enums
Gratiosly based on http://www.pinvoke.net/default.aspx/Enums/WindowsMessages.html
The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem
key is a key that is pressed when the ALT key is not pressed.
The WM_KEYUP message is posted to the window with the keyboard focus when a nonsystem key is released. A nonsystem
key is a key that is pressed when the ALT key is not pressed, or a keyboard key that is pressed when a window has the
keyboard focus.
The WM_CHAR message is posted to the window with the keyboard focus when a WM_KEYDOWN message is translated by the
TranslateMessage function. The WM_CHAR message contains the character code of the key that was pressed.
The WM_SYSKEYDOWN message is posted to the window with the keyboard focus when the user presses the F10 key (which
activates the menu bar) or holds down the ALT key and then presses another key. It also occurs when no window
currently has the keyboard focus; in this case, the WM_SYSKEYDOWN message is sent to the active window. The window
that receives the message can distinguish between these two contexts by checking the context code in the lParam
parameter.
The WM_SYSKEYUP message is posted to the window with the keyboard focus when the user releases a key that was pressed
while the ALT key was held down. It also occurs when no window currently has the keyboard focus; in this case, the
WM_SYSKEYUP message is sent to the active window. The window that receives the message can distinguish between these
two contexts by checking the context code in the lParam parameter.
The WM_SYSCHAR message is posted to the window with the keyboard focus when a WM_SYSKEYDOWN message is translated by
the TranslateMessage function. It specifies the character code of a system character key — that is, a character key
that is pressed while the ALT key is down.
Sent to an application when the IME gets a character of the conversion result. A window receives this message through
its WindowProc function.
Sent immediately before the IME generates the composition string as a result of a keystroke. A window receives this
message through its WindowProc function.
Sent to an application when the IME ends composition. A window receives this message through its WindowProc function.
Sent to an application when the IME changes composition status as a result of a keystroke. A window receives this
message through its WindowProc function.
Sent to an application when a window is activated. A window receives this message through its WindowProc function.