当前位置: 首页>>代码示例>>C#>>正文


C# ToolTip.SetResourceReference方法代码示例

本文整理汇总了C#中System.Windows.Controls.ToolTip.SetResourceReference方法的典型用法代码示例。如果您正苦于以下问题:C# ToolTip.SetResourceReference方法的具体用法?C# ToolTip.SetResourceReference怎么用?C# ToolTip.SetResourceReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.ToolTip的用法示例。


在下文中一共展示了ToolTip.SetResourceReference方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UpdateToolTipContent

		void UpdateToolTipContent(IWpfTextViewLine line) {
			IGlyphTextMarkerHandlerContext glyphTextMarkerHandlerContext = null;
			foreach (var marker in glyphTextViewMarkerService.GetSortedGlyphTextMarkers(line)) {
				if (glyphTextMarkerHandlerContext == null)
					glyphTextMarkerHandlerContext = new GlyphTextMarkerHandlerContext(wpfTextViewHost, margin, line);
				var toolTipInfo = marker.Handler.GetToolTipContent(glyphTextMarkerHandlerContext, marker);
				if (toolTipInfo != null) {
					Debug.Assert(toolTip == null);
					toolTipMarker = marker;
					toolTip = new ToolTip();
					PopupHelper.SetScaleTransform(wpfTextViewHost.TextView, toolTip);

					var toolTipContentString = toolTipInfo.Content as string;
					if (toolTipContentString != null) {
						toolTip.Content = new TextBlock {
							Text = toolTipContentString,
							TextWrapping = TextWrapping.Wrap,
						};
					}
					else
						toolTip.Content = toolTipInfo.Content;

					var toolTipStyle = toolTipInfo.Style as Style;
					if (toolTipStyle != null)
						toolTip.Style = toolTipStyle;
					else
						toolTip.SetResourceReference(FrameworkElement.StyleProperty, toolTipInfo.Style ?? "GlyphTextMarkerToolTipStyle");

					toolTip.Placement = PlacementMode.Relative;
					toolTip.PlacementTarget = margin.VisualElement;
					toolTip.HorizontalOffset = 0;
					toolTip.VerticalOffset = toolTipLine.TextBottom - wpfTextViewHost.TextView.ViewportTop + 1;
					toolTip.IsOpen = true;
					return;
				}
			}
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:37,代码来源:GlyphTextMarkerServiceMouseProcessor.cs

示例2: ShowToolTip

		void ShowToolTip() {
			if (session.IsDismissed)
				return;
			var completionVM = control.completionsListBox.SelectedItem as CompletionVM;
			if (completionVM == toolTipCompletionVM)
				return;
			HideToolTip();
			if (completionVM == null)
				return;
			var container = control.completionsListBox.ItemContainerGenerator.ContainerFromItem(completionVM) as ListBoxItem;
			if (container == null || !container.IsVisible)
				return;
			var toolTipElem = TryGetToolTipUIElement(completionVM);
			if (toolTipElem == null)
				return;

			// When the tooltip was reused, it was empty every other time, so always create a new one.
			toolTip = new ToolTip {
				Placement = PlacementMode.Right,
				Visibility = Visibility.Collapsed,
				IsOpen = false,
			};
			toolTip.SetResourceReference(FrameworkElement.StyleProperty, "CompletionToolTipStyle");

			// There's a scrollbar; place the tooltip to the right of the main control and not the ListBoxItem
			var pointRelativeToControl = container.TranslatePoint(new Point(0, 0), control);
			toolTip.VerticalOffset = pointRelativeToControl.Y;
			toolTip.PlacementTarget = control;
			toolTip.Content = toolTipElem;
			toolTip.Visibility = Visibility.Visible;
			Debug.Assert(!toolTip.IsOpen, "Can't set the tool tip's LayoutTransform if it's open");
			PopupHelper.SetScaleTransform(wpfTextView, toolTip);
			toolTipCompletionVM = completionVM;
			toolTip.IsOpen = true;
		}
开发者ID:manojdjoshi,项目名称:dnSpy,代码行数:35,代码来源:CompletionPresenter.cs

示例3: TextView_MouseHover

        void TextView_MouseHover(object sender, MouseEventArgs e)
        {
            var info = refFinder.GetReference(e);
            if (info == null || info.Value.Language == null || info.Value.Reference == null)
                return;

            var ttContent = codeToolTipManager.CreateToolTip(info.Value.Language, info.Value.Reference);
            if (ttContent == null)
                return;
            Close();
            toolTip = new ToolTip {
                Content = ttContent,
                IsOpen = true,
            };
            toolTip.SetResourceReference(FrameworkElement.StyleProperty, "CodeToolTip");
        }
开发者ID:GreenDamTan,项目名称:dnSpy,代码行数:16,代码来源:ToolTipHelper.cs


注:本文中的System.Windows.Controls.ToolTip.SetResourceReference方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。