I have a DataGrid
that contains a list of people that have email addresses. What I would like is that when the user clicks on one of the email addresses in the column, a new email is composed in outlook ready for the user to send.
I am currently having issues however with programming the click event on the column, this is what I have so far;
<DataGridHyperlinkColumn Header="Email" Binding="{Binding Email}">
<DataGridHyperlinkColumn.ElementStyle>
<Style TargetType="TextBlock">
<EventSetter Event="Hyperlink.Click" Handler="OnHyperlinkClick" />
</Style>
</DataGridHyperlinkColumn.ElementStyle>
And then the click event;
private void OnHyperlinkClick(object sender, RoutedEventArgs e)
{
MessageBox.Show("Test");
}
This however causes a crash, stating that it cannot locate the resource and then the users email address. How can I program the click so that it works correctly?