當前位置: 首頁>>代碼示例>>C#>>正文


C# ToolTip.SetValue方法代碼示例

本文整理匯總了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);
 }
開發者ID:kaushik1605,項目名稱:sample_DotNet,代碼行數:4,代碼來源:ToolTipHelper.cs

示例2: SetAutoMoveVerticalOffset

 public static void SetAutoMoveVerticalOffset(ToolTip element, double value)
 {
     element.SetValue(AutoMoveVerticalOffsetProperty, value);
 }
開發者ID:kaushik1605,項目名稱:sample_DotNet,代碼行數:4,代碼來源:ToolTipHelper.cs

示例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();
                }
            }
        }
開發者ID:JianwenSun,項目名稱:cc,代碼行數:64,代碼來源:PopupControlService.cs


注:本文中的System.Windows.Controls.ToolTip.SetValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。