本文整理匯總了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();
}
}
}