Пример #1
0
        public static void BuildToolTip(DEditorDocument EditorDocument, ToolTipRequestArgs ToolTipRequest)
        {
            if (!ToolTipRequest.InDocument)
            {
                return;
            }

            var dataOverride = new EditorData();

            dataOverride.ApplyFrom(EditorDocument);

            dataOverride.CaretLocation = new CodeLocation(ToolTipRequest.Column, ToolTipRequest.Line);
            dataOverride.CaretOffset   = EditorDocument.Editor.Document.GetOffset(ToolTipRequest.Position);

            var ttContents = AbstractTooltipProvider.BuildToolTip(dataOverride);

            if (ttContents == null)
            {
                return;
            }

            int offset = EditorDocument.Editor.Document.GetOffset(ToolTipRequest.Line, ToolTipRequest.Column);

            try
            {
                var vertStack = new StackPanel()
                {
                    Orientation = Orientation.Vertical
                };
                string lastDescription = "";
                foreach (var tt in ttContents)
                {
                    vertStack.Children.Add(
                        ToolTipContentHelper.CreateToolTipContent(
                            tt.Title,
                            lastDescription == tt.Description ? null : lastDescription = tt.Description)
                        as UIElement);
                }

                ToolTipRequest.ToolTipContent = vertStack;
            }
            catch { }
        }