wpf vue cef 交互

本文介绍如何在WPF用户控件中使用CefSharp加载网页,并实现实时通信。通过CefSharp的JavascriptObjectRepository注册对象,实现与Vue组件的交互,包括错误处理和关闭操作。
<UserControl x:Class="LabInOnePC.View.UcSampleBankView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:cef="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
             mc:Ignorable="d" Height="900" Width="1100">
    <Grid Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="48"></RowDefinition>
            <RowDefinition></RowDefinition>
        </Grid.RowDefinitions>
        <Button Cursor="Hand" Width="42" Height="42" BorderThickness="0" VerticalAlignment="Top" 
                    HorizontalAlignment="Right" x:Name="btnClose">
            <Button.Background>
                <ImageBrush ImageSource="/Images/PC/Close1.png"/>
            </Button.Background>
        </Button>
        <cef:ChromiumWebBrowser x:Name="webBrowser" Grid.Row="1"/>
        <Grid VerticalAlignment="Center" HorizontalAlignment="Center" x:Name="gdLoad" Grid.Row="1">
            <StackPanel>
                <Image Source="/Images/PC/LoadingData.png" Width="{StaticResource LoadingImageWidth}" Height="{StaticResource LoadingImageHeight}"></Image>
                <TextBlock Margin="0,14,0,0" Text="加载中…" Foreground="#666666" FontSize="{StaticResource FontSize12}" 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值