<Hyperlink NavigateUri="http://www.yahoo.com" RequestNavigate="Hyperlink_WhitePage_RequestNavigate" Name="Hyperlink_WhitePage" >
<Run Text="ABL Link"/>
</Hyperlink>
Code C# de thực thi Hyperlink_WhitePage_RequestNavigate
private void Hyperlink_WhitePage_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
{
Hyperlink currentLink = sender as Hyperlink;
string navigateUri = currentLink.NavigateUri.AbsoluteUri;
try
{
Process.Start(new ProcessStartInfo(navigateUri)); e.Handled = true;
}
catch
{
MessageBox.Show("Can't open this link !");
}
}
No comments:
Post a Comment