In my Silverlight app, I have aWebBrowser
component displaying random HTML content.
I would like to call C# methods from there (for example when I click on a [a href...] link).
Edit [add details] :
I will try to clarify my problem, sorry for the initial question badly asked :
In my XAML file, I have my webbrowser component :
<WebBrowser x:Name="HtmlMail" Grid.Row="1" Visibility="{Binding Visibility}" />
In the code behind, I have a method that load HTML in the webbrowser (HTML is from an external source) :
void _viewModel_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
{
string encoded = SilverMUT.Common.Tools.CString.ToHtml(_viewModel.MailSelected.Message);
HtmlMail.NavigateToString(encoded);
}
What I would like to do is add for example a button to the html view (this part is ok) and that a click on the button trigger a C# function.
Edit : if I can trap the click on links from within the WebBrowser and handle them in the code behind, this would be ok too
I've try in : System.Windows.Navigation.LoadCompletedEventHandler but can't make it works