void OnRequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
 {
     if (e.Uri != null)
     {
         InternetExplorer.OpenUrl(IntPtr.Zero, e.Uri);
     }
 }
Example #2
0
        public static Hyperlink GetOpenFileHyperlink(string label, string path)
        {
            Uri uri = new Uri(path, UriKind.RelativeOrAbsolute);

            Hyperlink link = new Hyperlink(new Run(label))
            {
                NavigateUri = uri,
            };

            link.PreviewMouseDown += new MouseButtonEventHandler((s, e) =>
            {
                InternetExplorer.OpenUrl(IntPtr.Zero, uri);
            });

            link.MouseEnter += new MouseEventHandler((s, e) =>
            {
                link.Foreground = AppTheme.Instance.GetThemedBrush("HyperlinkForeground");
            });

            link.MouseLeave += new MouseEventHandler((s, e) =>
            {
                link.SetValue(Hyperlink.ForegroundProperty, DependencyProperty.UnsetValue);
            });

            link.Cursor = Cursors.Arrow;

            return(link);
        }