Skip to content

Instantly share code, notes, and snippets.

View cefsharptutorials's full-sized avatar

cefsharptutorials

View GitHub Profile
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
//Set up the new handler instance
BrowserView.MenuHandler = new SearchContextMenuHandler();
}
}
<Window x:Class="ContextMenus.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ContextMenus"
xmlns:cef="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
mc:Ignorable="d"
Title="Context Menus" Height="350" Width="525">
<Grid>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void BrowserView_OnFrameLoadEnd(object sender, FrameLoadEndEventArgs e)
{
//Please note that the delegate is marked as ‘async’
<Window x:Class="GetSetHtml.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:GetSetHtml"
xmlns:cef="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
mc:Ignorable="d"
Title="GetSetHtml" Height="350" Width="525">
<Grid>
public partial class MainWindow : Window
{
private ChromiumWebBrowser leftBrowser;
private ChromiumWebBrowser rightBrowser;
public MainWindow()
{
InitializeComponent();
//Set the port which can be used for creating connection to the browser
<Window x:Class="RemoteDebugging.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:RemoteDebugging"
mc:Ignorable="d"
Title="RemoteDebugging" Height="350" Width="525">
<!--Define the name of the root grid-->
<Grid Name="RootGrid">
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title></title>
</head>
<body>
<script>
public partial class MainWindow : Window
{
private ChromiumWebBrowser Browser;
public MainWindow()
{
InitializeComponent();
//Create the browser
Browser = new ChromiumWebBrowser();
public class DotNetMessage
{
public void Show(string message)
{
MessageBox.Show(message);
}
}
<Window x:Class="InjectDotNetToJavaScript.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:InjectDotNetToJavaScript"
mc:Ignorable="d"
Title="InjectDotNetToJavaScript" Height="350" Width="525">
<!--Set the name of the root grid-->
<Grid Name="MainGrid">