Ejemplo n.º 1
0
 public ToolTipController()
 {
     myTip            = new ToolTip();
     myTimer          = new DispatcherTimer();
     myTimer.Interval = new TimeSpan(ToolTipService.GetInitialShowDelay(myTip) * 10000);
     myTimer.Tick    += new EventHandler(OnTick);
 }
        private void InitializeTooltipPart()
        {
            this.CreateTooltipPopup();
            Application.Current.Deactivated += this.Application_Deactivated;

            _tooltipTimer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(ToolTipService.GetInitialShowDelay(this))
            };

            _tooltipTimer.Tick += this.TooltipTimer_Tick;
        }
Ejemplo n.º 3
0
        protected void ShowToolTip(object sender, MouseEventArgs e)
        {
            var child   = sender as FrameworkElement;
            var toolTip = child.ToolTip as ToolTip;

            if (toolTip == null)
            {
                return;
            }
            var now = Environment.TickCount;

            if (toolTipStartTime == int.MaxValue)
            {
                toolTipStartTime = now;
                return;
            }
            var delay    = ToolTipService.GetInitialShowDelay(this);
            var duration = ToolTipService.GetShowDuration(this);

            toolTip.IsOpen = now > toolTipStartTime + delay && now < toolTipStartTime + delay + duration;
        }
Ejemplo n.º 4
0
        //</SnippetToolTipClosingHandler>

        //</SnippetToolTipOpenAndCloseHandler>

        private void showProperties(object sender, RoutedEventArgs e)
        {
            ttProperties.ClearValue(TextBlock.TextProperty);
            ttPropertyValues.ClearValue(TextBlock.TextProperty);
            //<SnippetGetBetweenShowDelay>
            int myInt = ToolTipService.GetBetweenShowDelay(
                (DependencyObject)FindName("ellipse2"));

            //</SnippetGetBetweenShowDelay>
            AddTextString(ttProperties, ttPropertyValues, "BetweenShowDelay",
                          myInt.ToString());
            //<SnippetGetInitialShowDelay>
            myInt = ToolTipService.GetInitialShowDelay(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetInitialShowDelay>
            AddTextString(ttProperties, ttPropertyValues, "InitialShowDelay",
                          myInt.ToString());
            //<SnippetGetShowDuration>
            myInt = ToolTipService.GetShowDuration(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetShowDuration>
            AddTextString(ttProperties, ttPropertyValues, "ShowDuration",
                          myInt.ToString());
            //<SnippetGetHasDropShadow>
            bool myBool = ToolTipService.GetHasDropShadow(
                (DependencyObject)FindName("ellipse2"));

            //</SnippetGetHasDropShadow>
            AddTextString(ttProperties, ttPropertyValues, "HasDropShadow",
                          myBool.ToString());
            //<SnippetGetHorizontalOffset>
            double myDouble = ToolTipService.GetHorizontalOffset(
                (DependencyObject)FindName("ellipse2"));

            //</SnippetGetHorizontalOffset>
            AddTextString(ttProperties, ttPropertyValues, "HorizontalOffset",
                          myDouble.ToString());
            //<SnippetGetVerticalOffset>
            myDouble = ToolTipService.GetVerticalOffset(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetVerticalOffset>
            AddTextString(ttProperties, ttPropertyValues, "VerticalOffset",
                          myDouble.ToString());
            //<SnippetGetPlacement>
            PlacementMode myMode = ToolTipService.GetPlacement(
                (DependencyObject)FindName("ellipse2"));

            //</SnippetGetPlacement>
            AddTextString(ttProperties, ttPropertyValues, "Placement",
                          myMode.ToString());
            //<SnippetGetPlacementRectangle>
            Rect myRect = ToolTipService.GetPlacementRectangle(
                (DependencyObject)FindName("ellipse2"));

            //</SnippetGetPlacementRectangle>
            AddTextString(ttProperties, ttPropertyValues, "PlacementRectangle",
                          myRect.ToString());
            //<SnippetGetPlacementTarget>
            UIElement target = new UIElement();

            target = ToolTipService.GetPlacementTarget(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetPlacementTarget>
            if (target == null)
            {
                AddTextString(ttProperties, ttPropertyValues, "PlacementTarget",
                              "null");
            }
            else
            {
                AddTextString(ttProperties, ttPropertyValues, "PlacementTarget",
                              target.ToString());
            }
            //<SnippetGetIsDropShadow>
            myBool = ToolTipService.GetHasDropShadow(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetIsDropShadow>
            AddTextString(ttProperties, ttPropertyValues, "HasDropShadow",
                          myBool.ToString());
            //<SnippetGetIsEnabled>
            myBool = ToolTipService.GetIsEnabled(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetIsEnabled>
            AddTextString(ttProperties, ttPropertyValues, "IsEnabled",
                          myBool.ToString());
            //<SnippetGetIsOpen>
            myBool = ToolTipService.GetIsOpen(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetIsOpen>
            AddTextString(ttProperties, ttPropertyValues, "IsOpen",
                          myBool.ToString());
            //<SnippetGetShowOnDisabled>
            myBool = ToolTipService.GetShowOnDisabled(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetShowOnDisabled>
            AddTextString(ttProperties, ttPropertyValues, "ShowOnDisabled",
                          myBool.ToString());
            //<SnippetGetToolTip>
            target = (UIElement)ToolTipService.GetToolTip(
                (DependencyObject)FindName("ellipse2"));
            //</SnippetGetToolTip>
            AddTextString(ttProperties, ttPropertyValues, "ToolTip",
                          target.ToString());
        }
Ejemplo n.º 5
0
 static ToolTipController()
 {
     _timer.Interval = new TimeSpan(ToolTipService.GetInitialShowDelay(_tip) * 10000);
     _timer.Tick    += timer_Tick;
 }
Ejemplo n.º 6
0
 static ToolTipController()
 {
     timer.Interval = new TimeSpan(ToolTipService.GetInitialShowDelay(tip) * 10000);
     timer.Tick    += new EventHandler(timer_Tick);
 }