I'm trying to get CefSharp to play nicely with Caliburn.Micro, but that wasn't as easy as I'd hoped. It's probably still easy but I'm just not familiar enough with either of them.
I added a browser component to my view:
<cefsharp:ChromiumWebBrowser x:Name="Browser"></cefsharp:ChromiumWebBrowser>
Then I added a property in my view model with the same name:
public ChromiumWebBrowser Browser { get; set; }
I had now hoped that Caliburn.Micro's magic had bound this property to the actual browser in the view so that I could use Browser
from my code-behind.
To test this I try to go to a specific webpage when the view is activated:
protected override void OnActivate()
{
Browser.Dispatcher.Invoke(() =>
{
Browser.Address = "http://stackoverflow.com";
NotifyOfPropertyChange(() => Browser);
});
base.OnActivate();
}
Because Browser is owned by a different thread I'm using the Dispatcher to be able to access it properly.
All this code runs just fine without any exceptions but SO is not opened when the browser loads.
I'm guessing this is because I haven't been able to get Caliburn.Micro to properly bind the two ChromiumWebBrowser
objects together.
How can I accomplish this?