/// <summary> /// Process command when a hyperlink has been clicked. /// Start a web browser and let it browse to where this points to... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void Hyperlink_CommandNavigateTo(object sender, ExecutedRoutedEventArgs e) { if (sender == null || e == null) { return; } e.Handled = true; FileHyperlink whLink = sender as FileHyperlink; if (whLink == null) { return; } try { Process.Start(new ProcessStartInfo(whLink.NavigateUri)); ////OpenFileLocationInWindowsExplorer(whLink.NavigateUri.OriginalString); } catch (System.Exception ex) { MessageBox.Show(string.Format(CultureInfo.CurrentCulture, "{0}\n'{1}'.", ex.Message, (whLink.NavigateUri == null ? string.Empty : whLink.NavigateUri.ToString())), "Error finding requested resource", MessageBoxButton.OK, MessageBoxImage.Error); } }
private static void Hyperlink_OpenContainingFolder(object sender, ExecutedRoutedEventArgs e) { if (sender == null || e == null) { return; } e.Handled = true; FileHyperlink whLink = sender as FileHyperlink; if (whLink == null) { return; } OpenFileLocationInWindowsExplorer(whLink.NavigateUri); }
/// <summary> /// A hyperlink has been clicked. Start a web browser and let it browse to where this points to... /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private static void CopyHyperlinkUri(object sender, ExecutedRoutedEventArgs e) { if (sender == null || e == null) { return; } e.Handled = true; FileHyperlink whLink = sender as FileHyperlink; if (whLink == null) { return; } try { System.Windows.Clipboard.SetText(whLink.NavigateUri); } catch { } }