示例#1
0
        private void OnElementPointerMoved(object sender, PointerRoutedEventArgs e)
        {
            var placement = CustomTooltipService.GetPlacement(Element);

            if (PlacementMode.Mouse != placement)
            {
                return;
            }
        }
示例#2
0
        private void OnElementPointerEntered(object sender, PointerRoutedEventArgs e)
        {
            if (null != popup)
            {
                return;
            }

            var tooltip   = CustomTooltipService.GetTooltip(Element);
            var placement = PlacementMode.Bottom;// CustomTooltipService.GetPlacement(Element);
            var host      = tooltip as CustomTooltip;

            if (null == host)
            {
                host = new CustomTooltip
                {
                    Content = tooltip
                };
            }

            popup = new Popup
            {
                Child  = host,
                IsOpen = true,
                IsLightDismissEnabled = true
            };

            host.SetBinding(
                FrameworkElement.DataContextProperty,
                new Binding
            {
                Path   = new PropertyPath("DataContext"),
                Source = Element
            });

            UIElement placementTarget = null;

            if (placement != PlacementMode.Mouse)
            {
                placementTarget = CustomTooltipService.GetPlacementTarget(Element) ?? (sender as UIElement);
            }

            PerformPlacement(popup, placement, placementTarget, e.GetCurrentPoint(Window.Current.Content));
        }