本文整理汇总了C#中System.Windows.Controls.ToolTip.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ToolTip.SetValue方法的具体用法?C# ToolTip.SetValue怎么用?C# ToolTip.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Controls.ToolTip
的用法示例。
在下文中一共展示了ToolTip.SetValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetAutoMove
public static void SetAutoMove(ToolTip element, bool value)
{
element.SetValue(AutoMoveProperty, value);
}
示例2: SetAutoMoveVerticalOffset
public static void SetAutoMoveVerticalOffset(ToolTip element, double value)
{
element.SetValue(AutoMoveVerticalOffsetProperty, value);
}
示例3: RaiseToolTipOpeningEvent
private void RaiseToolTipOpeningEvent()
{
ResetToolTipTimer();
if (_forceCloseTimer != null)
{
OnForceClose(null, EventArgs.Empty);
}
DependencyObject o = LastMouseOverWithToolTip;
if (o != null)
{
bool show = true;
IInputElement element = o as IInputElement;
if (element != null)
{
ToolTipEventArgs args = new ToolTipEventArgs(true);
element.RaiseEvent(args);
show = !args.Handled;
}
if (show)
{
object tooltip = ToolTipService.GetToolTip(o);
ToolTip tip = tooltip as ToolTip;
if (tip != null)
{
_currentToolTip = tip;
_ownToolTip = false;
}
else if ((_currentToolTip == null) || !_ownToolTip)
{
_currentToolTip = new ToolTip();
_ownToolTip = true;
_currentToolTip.SetValue(ServiceOwnedProperty, BooleanBoxes.TrueBox);
// Bind the content of the tooltip to the ToolTip attached property
Binding binding = new Binding();
binding.Path = new PropertyPath(ToolTipService.ToolTipProperty);
binding.Mode = BindingMode.OneWay;
binding.Source = o;
_currentToolTip.SetBinding(ToolTip.ContentProperty, binding);
}
if (!_currentToolTip.StaysOpen)
{
// The popup takes capture in this case, which causes us to hit test to the wrong window.
// We do not support this scenario. Cleanup and then throw and exception.
throw new NotSupportedException(SR.Get(SRID.ToolTipStaysOpenFalseNotAllowed));
}
_currentToolTip.SetValue(OwnerProperty, o);
_currentToolTip.Closed += OnToolTipClosed;
_currentToolTip.IsOpen = true;
ToolTipTimer = new DispatcherTimer(DispatcherPriority.Normal);
ToolTipTimer.Interval = TimeSpan.FromMilliseconds(ToolTipService.GetShowDuration(o));
ToolTipTimer.Tick += new EventHandler(OnRaiseToolTipClosingEvent);
ToolTipTimer.Start();
}
}
}