Now that I have the hyperlink button working, I want to do something a little more complicated. When I click the hyperlink button, I would like to both open a window and navigate to the URL specified, as is currently the case, but at the same time, I would like to execute a method in code behind. I tried adding a click event handler to the hyperlink as follows:
// Add a link to display the GeoSCAN record in a popup
string attributeName = "GEOSCANREC";
DataTemplate cellTemplate =
(DataTemplate)System.Windows.Markup.XamlReader.Load(@"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007"">
<HyperlinkButton NavigateUri=""{Binding Attributes[" + attributeName +
@"], StringFormat='http://geoscan.ess.nrcan.gc.ca/starweb/geoscan/servlet.starweb?path=geoscan/geoscanfastlink_e.web&search1=R=\{0\}'}""
TargetName=""_blank"" Click=""DoSomethingOnClick"" ToolTipService.ToolTip=""{StaticResource strDisplayGeoscanRecord}"" ><Image Source=""/Minimal;component/Images/DotDotDot.png"" Width=""18"" Height=""22"" />
</HyperlinkButton> </DataTemplate>");
QueryDetailsDataGrid.Columns.Add(new DataGridTemplateColumn()
{
Width = new DataGridLength(115),
Header = LanguageResources.strGeoscanHeader.ToString(),
CellTemplate = cellTemplate
});
What that does is give an error as in the attachment. I get the same result if I try to move the click event to a onleftmousedown event handler on the Image instead.Is there a way to get the two things done on a single click?