/// <summary>Hack into the default QuickInfo panel and provides click and go feature for symbols.</summary> public void ApplyClickAndGo(ISymbol symbol, IQuickInfoSession quickInfoSession) { if (symbol == null) { return; } var description = MainDesciption; if (description == null) { return; } if (symbol.IsImplicitlyDeclared) { symbol = symbol.ContainingType; } QuickInfoOverrider.ApplyClickAndGo(symbol, description, quickInfoSession); }
void FixQuickInfo(StackPanel infoPanel) { var titlePanel = infoPanel.GetFirstVisualChild <WrapPanel>(); if (titlePanel == null) { return; } var doc = titlePanel.GetParent <StackPanel>(); if (doc == null) { return; } var v16_1orLater = titlePanel.GetParent <ItemsControl>().GetParent <ItemsControl>() != null; titlePanel.HorizontalAlignment = HorizontalAlignment.Stretch; doc.HorizontalAlignment = HorizontalAlignment.Stretch; var icon = infoPanel.GetFirstVisualChild <CrispImage>(); var signature = infoPanel.GetFirstVisualChild <TextBlock>(); // beautify the title panel if (Config.Instance.QuickInfoOptions.MatchFlags(QuickInfoOptions.AlternativeStyle)) { if (icon != null) { infoPanel.GetParent <Border>().Background = new VisualBrush(CreateEnlargedIcon(icon)) { Opacity = 0.3, AlignmentX = AlignmentX.Right, AlignmentY = AlignmentY.Bottom, TileMode = TileMode.None, Stretch = Stretch.None }; icon.Visibility = Visibility.Collapsed; } var c = infoPanel.GetParent <Border>(); c.Margin = __DocPanelBorderMargin; c.Padding = __DocPanelBorderPadding; c.MinHeight = 50; titlePanel.Margin = __TitlePanelMargin; } // replace the default XML doc // sequence of items in default XML Doc panel: // 1. summary // 2. type parameter // 3. usage // 4. exception var items = doc.IsItemsHost ? (IList)doc.GetParent <ItemsControl>().Items : doc.Children; if (DocElement != null) { OverrideDocElement(doc, v16_1orLater, items); } if (ExceptionDoc != null) { OverrideExceptionDocElement(doc, v16_1orLater, items); } if (icon != null && signature != null) { // apply click and go feature if (ClickAndGoSymbol != null) { QuickInfoOverrider.ApplyClickAndGo(ClickAndGoSymbol, signature, QuickInfoSession); } // fix the width of the signature part to prevent it from falling down to the next row if (Config.Instance.QuickInfoMaxWidth > 0) { signature.MaxWidth = Config.Instance.QuickInfoMaxWidth - icon.Width - 30; } } }