示例#1
0
        public static void AttachRequestNaviateEventHandler(Hyperlink hyperLink, IServiceProvider serviceProvider)
        {
            if (s_instance == null)
            {
                // this has a race, so we might end up have more than one navigator. but it shouldn't matter.
                s_instance = new UriNavigator(serviceProvider);
            }

            hyperLink.RequestNavigate += s_instance.OnRequestNavigate;
        }
示例#2
0
        public static void AttachRequestNavigateEventHandler(Hyperlink hyperLink, IServiceProvider serviceProvider)
        {
            if (s_instance == null)
            {
                // this has a race, so we might end up have more than one navigator. but it shouldn't matter.
                s_instance = new UriNavigator();
            }

            hyperLink.RequestNavigate += s_instance.OnRequestNavigate;
        }
                    private FrameworkElement GetHyperLinkTextBlock(DiagnosticData item, Uri uri, bool bingLink)
                    {
                        // currently, we can't do pooling since there is no event saying when this got out of view.
                        var content = new TextBlock()
                        {
                            Background = null,
                            ToolTip    = item.Id,
                        };

                        var hyperlink = new Hyperlink();

                        hyperlink.Inlines.Add(item.Id);
                        hyperlink.NavigateUri = uri;
                        content.Inlines.Add(hyperlink);

                        // hyperlink will go away as soon as it goes out of view or updated.
                        hyperlink.Tag = item;

                        // use small event handler singleton object so that leaking ui doesnt make snapshot to leak.
                        UriNavigator.AttachRequestNaviateEventHandler(hyperlink, _factory._source._serviceProvider);
                        return(content);
                    }