我通过NuGet在应用程序中安装了NuGet,然后在app.xaml.cs OnStartup()方法中初始化了它。当我的应用程序运行时,我没有任何显示,也没有错误。将视图切换到另一个不正常使用CefSharp显示的视图。我只是看不出有什么网页可以用CefSharp渲染。
View QuestHTMLView
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
</Grid.RowDefinitions>
<cefSharp:ChromiumWebBrowser Grid.Row="0" Address="https://github.com/cefsharp/CefSharp/wiki/Frequently-asked-questions" />
</Grid>ViewModel QuestHTMLViewModel
public class QuestHTMLViewModel : Screen
{
}ShellView (呈现前一个视图的地方)
<xctk:BusyIndicator VerticalAlignment="Top" Grid.Row="1" Grid.Column="0" Grid.RowSpan="2" IsBusy="{Binding IsBusy}">
<ContentControl x:Name="ActiveItem" />
</xctk:BusyIndicator>ShellViewModel ( CefSharp视图设置为ActiveItem)
public ShellViewModel()
{
QuestHTML = new QuestHTMLViewModel();
ActiveItem = QuestHTML;
}Initialization
protected override void OnStartup(StartupEventArgs e)
{
Cef.Initialize(new CefSettings());
base.OnStartup(e);
}发布于 2016-02-05 21:30:48
您应该在Window方法中初始化并显示OnStartUp():
protected override void OnStartup(StartupEventArgs e)
{
MainWindow = new MainWindow();
MainWindow.ShowDialog();
base.OnStartup(e);
}不要忘记从StartupUri中删除App.xaml属性。App.xaml应该如下所示:
<Application x:Class="TestPlace.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
</Application.Resources>
</Application>https://stackoverflow.com/questions/35233687
复制相似问题