Files
Alex Maitland f43cd64c55 Import CefSharp.Wpf.HwndHost into main repository. (#4981)
* HwndHost - Initial import

* HwndHost - Add Example to solution and use common IWpfChromiumWebBrowser interface

* HwndHost - Update UpdateNugetPackages.ps1

* HwndHost - Add Nuspec

* HwndHost Example - Upgrade version

* HwndHost Example - Try non self contained build for debug and release

* Test - Add basic HwndHost tests

Probably need to revisit these, little bit hacky creating the window

* HwndHost - Allow any RequestContext that inherits from Core.RequestContext

Cheery pick of https://github.com/cefsharp/CefSharp.Wpf.HwndHost/pull/31

* HwndHost Example - Disable arm64

Example will be removed shortly, so it doesn't matter too much now.
It will be moved to MinimalExample and the Wpf Example expanded

* HwndHost - Delete delegate command

* Upgrade packages

* Nuget - Move Nuspec file to PackageReference folder

---------

Co-authored-by: amaitland <307872+amaitland@users.noreply.github.com>
2025-01-18 06:40:48 +10:00

42 lines
1.1 KiB
C#

using System.Windows;
using System.Windows.Controls;
namespace CefSharp.Wpf.HwndHost.Example
{
/// <summary>
/// Interaction logic for TabbedMainWindow.xaml
/// </summary>
public partial class TabbedMainWindow : Window
{
public TabbedMainWindow()
{
InitializeComponent();
NewTab();
NewTab();
NewTab();
}
private void NewTab()
{
var browser = new ChromiumWebBrowser("https://example.com/");
browser.Address = "https://example.com/";
Tabs.Items.Add(new TabItem { Header = "Tab", Content = browser });
}
private void OnNewTabButtonClick(object sender, RoutedEventArgs e)
{
NewTab();
}
private void OnCloseTabButtonClick(object sender, RoutedEventArgs e)
{
var Tab = (TabItem)Tabs.Items[Tabs.SelectedIndex];
var browser = (ChromiumWebBrowser)Tab.Content;
Tab.Content = null;
browser.Dispose();
Tabs.Items.Remove(Tab);
}
}
}