I have a problem in navigation in xBap
I created two pages (Page1 and Page2)
Page1 have one button for navigation to Page 2
<Button Height="23" Width="76" Name="button1" Click="button1_Click">Page2</Button>
private void button1_Click(object sender, RoutedEventArgs e)
{
NavigationService n = NavigationService.GetNavigationService(sender as Button);
n.Navigate(new Uri("Page2.xaml", UriKind.Relative));
}
in Page2 there is a frame without any source
<Frame Margin="0,90,0,0"/>
After running application, and navigating to page2, the navigation will work normally,
but when I press Go Back in browser, then press button1 again
The browser will show this message
image
Note: in some cases you need to repeat trying
Any help !!
thanks in advance
since your Browser crashes, i suggest this is some bug in one of the following Components:
Browser (IE in this Case)
XBAP Addon/Plugin (yes, there is some kind of plugin which is installed silently within browsers on .NET Framework installation)
I bet, this cannot be solved programmatically... I'd suggest the following:
try to reproduce in different environment (different IE Version, OS etc.)
reinstall .NET Framework and ensure you have the latest, stable final version
do same with Internet Explorer
Firefox has XBAP support as well - try in firefox
If it works in other environments, your users should have no problems with this setup.
Hope this helps,
Best regards
Thomas
Related
I have issues with initializing CefSharp3. The control give a blank page after initializing.
I follow the instructions from CefSharp Wiki page (https://github.com/cefsharp/CefSharp/wiki/Quick-Start and http://ourcodeworld.com/articles/read/173/how-to-use-cefsharp-chromium-embedded-framework-csharp-in-a-winforms-application)
The problem is that when I build the application for x64 i get a blank page, but it works fine in x86.
The only code in my WinForms project is this:
public ChromiumWebBrowser chromeBrowser;
public void InitializeChromium()
{
CefSettings settings = new CefSettings();
// Initialize cef with the provided settings
Cef.Initialize(settings);
// Create a browser component
chromeBrowser = new ChromiumWebBrowser("http://ourcodeworld.com");
// Add it to the form and fill it to the form window.
this.Controls.Add(chromeBrowser);
chromeBrowser.Dock = DockStyle.Fill;
}
public Form1()
{
InitializeComponent();
// Start the browser after initialize global component
InitializeChromium();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
Cef.Shutdown();
}
I also tried adding a panel, and initializing ChromiumBrowser in the panel with panel1.Controls.Add(chromeBrowser) instead of this.Controls.add(chromeBrowser), but the issue is still there.
I found this in the troubleshooting section at CefSharp wiki:
https://github.com/cefsharp/CefSharp/wiki/Trouble-Shooting
b) The developer tools. Add a button to your form and make a call to "browser.ShowDevTools()". If you can see a document has loaded and you have a DOM in there, then your problem is a display output one and your most likely problem is one of not setting 'Dock' correctly, or some other setting is causing the browser to render offscreen/headless. If you get a blank tool window, or no tool window at all, then CefSharp has failed to initialize correctly, so you have a set-up issue to troubleshoot.
This is exactly the symptoms that I experience.
I tried creating the same project on my laptop (MacBook Pro with Win7, VS2013 and .NET 4.5.2) and it worked like a charm. This means something is up with my workstation (win10, VS2015 .NET 4.5.3).
Any ideas?
This appears to be a bug in the latest build. The solution for now is to use the v51.0.0 build.
You can do this quite easily in the NuGet package manager in VS2015, or if your using VS2013, use the "--version 51.0.0" option when installing cefsharp from the package manager command line.
The issue for the problem is here:
https://github.com/cefsharp/CefSharp/issues/1870
Keep an eye on the issue for future solutions.
Update 28/11/2016
This is a bug in the current V53 release of CefSharp. It's been confirmed by the CefSharp team and is addressed in issue #1819 (https://github.com/cefsharp/CefSharp/issues/1819)
The bug has been apparently fixed, but will not be released until V55.
The solution for now, is to either go back to V51 or to build your own version from source for V55.
I have a WPF application which uses CEF to display web content. My question is, is there a way to debug the Javascript/Web parts inside a WPF application?
You may also use ShowDevTools() extension method (source)
ChromiumWebBrowser browser = new ChromiumWebBrowser();
browser.ShowDevTools(); // Opens Chrome Developer tools window
Enable remote debugging in your application:
C# (CefSharp)
CefSettings.RemoteDebuggingPort = 8088;
C++
CefSettings settings;
settings.remote_debugging_port = 8088;
then run your app and point your browser to http://localhost:8088/ to access the Chromium developer console (the same you have in Chrome with Ctrl+Shift+j)
While the accepted answer is correct, it doesn't really have enough detail.
I got this working in CefSharp using the WinForms control in a WPF application. (the WinForms control seems to have better performance). The code for remote debugging will probably be very similar for the WPF control though.
var settings = new CefSettings { RemoteDebuggingPort = 8088 };
Cef.Initialize(settings);
WindowsFormsHost.Child = new ChromiumWebBrowser(url);
Then go to http://localhost:8088/ in your browser.
To use 'ShowDevTools()' you will need first verify if the browser is initialized.
An example solution:
//Add an event to check
ChromeBrowser.IsBrowserInitializedChanged += ChromeBrowser_IsBrowserInitializedChanged;
//Declare the event method to be called
private void ChromeBrowser_IsBrowserInitializedChanged(object sender, IsBrowserInitializedChangedEventArgs e)
{
if (e.IsBrowserInitialized)
{
ChromeBrowser.ShowDevTools();
}
}
To open the Chromium Dev-Tools window you can do the following:
CefBrowser.GetBrowser().GetHost().ShowDevTools();
This is similar to Eido95's answer, but it doesn't require the extension methods, which essentially just wrap these method calls.
NOTE: The control needs to be initialized before calling this method can be called. If you're wiring-up and F12-like functionality this shouldn't be a problem. If you're trying to do this when the app is starting you will need to listen for the ChromiumWebBrowser.IsBrowserInitializedChanged event
An alternative can be to launch cef with --enable-chrome-runtime.
You'll have the fully featured debugger (link files on disk and edit them from the debugger)
I am using Windows 7 Ult., IE9, Chrome. I have just installed Silverlight 5 and am trying to develop an app using DevExpress DXMap control and Silverlight. However, I am having issues with Silverlight it seems. When I go to this site (http://www.silverlight.net/learn/overview/what's-new-in-silverlight-5/introduction-to-silverlight-5-3d) to watch a video on the Silverlight 3d feature, the video player which I believe is a Silverlight control loads, but then disappears. When I run the app with the DXMap control, the page loads a blank area with only the zoom control, navigation pad, and scale visible.
I have tried finding a solution to this problem, but have not been successful. Any suggestions?
Okay, I found out what was the issue. I thought that not checking the "Host the silverlight application in a new web site" option (since I never had a website as yet) would let the application load on its own, but I had to enable the "Host the silverlight application in a new web site" option to get it associated with a test page.
I am working on a WPF app which has Web Browser in one of its views. When I run the Application, It works fine but the Web Browser Control sits on top of my wpf region. I know this is something to do with the AirSpace issue. Is there any possible way to get over it? Any help will be appreciated.
Thanks
The issue was not solved in WPF 4.5.
There were some information in net such the below mentioned properties would be available with the 4.5 version of web browser control, however the plan has been dropped. So you need to handle the airspace issue by yourself.
WebBrowser.CompositionMode = System.Windows.Interop.CompositionMode.Full;
WebBrowser.IsRedirected = true;
The workaround that you could do is by making the height of the web browser control to zero, when some other control comes in front of Web browser control.
Find sample code below,
Assume, you have a web browser control in Mainwindow. When you perform some action,, eg: click a button you have another user control which comes above MainWindow. However, because of Airspace issue the web browser doesn't sit in its parent control and comes on top of your control.
FIX:
The standard fix is you can set the height of web browser to zero when you trigger some other control over it depends upon your scenario. Below, there is a sample implementation.
In MainWindow.Xaml include the events.
Activated="Window_Activated"
Deactivated="Window_Deactivated"
In Xaml.cs handle the scenario by setting the height.
private void Window_Activated(object sender, EventArgs e)
{
wb.Height = double.NaN;
}
private void Window_Deactivated(object sender, EventArgs e)
{
wb.Height = 0;
}
Here is technical information for why this happens.
Some tips and suggestions to get rid of that
This is a known problems, as Neeraj posts. But with WPF 4.5 this seems to be solved, so if you don't mind using the beta version you should download Visual Studio 11.
Try Chris84898's AirspaceFixer project.
https://github.com/chris84948/AirspaceFixer
You just host the problematic control inside a panel, and it does the heavy lifting for you.
XAML:
<asf:AirspacePanel x:Name="ap"
FixAirspace="{Binding FixAirspace}"
Grid.Column="0" Grid.Row="1" >
<WebBrowser x:Name="browser" Navigated="Browser_Navigated" />
</asf:AirspacePanel>
To temporarily "FixAirspace" in code (or through dependency property changes):
ap.FixAirspace = true;
// Display a dialog or whatever
ap.FixAirspace = false;
There is a NuGet package for it as well.
This is probably something simple, but I can't seem to find the answer.
I want to have a button on an app that navigates to a core OS page, eg.. Email setup, or Mobile network.
I assume it is a variation of below, but I im not sure what the format would be for accessing a page on the os from the app.
Any help would be greatly appreciated.
private void button_Click(object sender, EventArgs e)
{
this.NavigationService.Navigate(new Uri(
String.Format("/PageName.xaml)),
UriKind.Relative));
}
At the moment, there's no way to access every OS page, such as the Mobile Network page. However, there are some Launchers and Choosers you can use. That MSDN link is for 7.1 (Mango) so not all Launchers and Choosers mentioned there will be available if you're targetting 7.0. Is there anything in particular you're trying to achieve? There may be an alternate method available.