Interaction logic for TileToolTipControl.xaml
Inheritance: System.Windows.Controls.UserControl
Ejemplo n.º 1
0
        public ToolTipService(MapControl3D control)
        {
            m_control = control;
            m_hoverTileView = control.HoverTileView;

            m_content = new TileToolTipControl();
            m_content.DataContext = m_hoverTileView;

            var popup = new ToolTip();
            popup.Content = m_content;
            popup.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
            popup.HorizontalOffset = 4;
            popup.PlacementTarget = m_control;
            m_popup = popup;

            // Disable the animations, because we lose datacontext during fade-out animation.
            // We need to override the default values in the PlacementTarget control
            m_control.Resources.Add(SystemParameters.ToolTipAnimationKey, false);
            m_control.Resources.Add(SystemParameters.ToolTipFadeKey, false);
            m_control.Resources.Add(SystemParameters.ToolTipPopupAnimationKey, PopupAnimation.None);

            this.IsToolTipEnabled = true;

            m_control.GotMouseCapture += (s, e) => this.IsToolTipEnabled = false;
            m_control.LostMouseCapture += (s, e) => this.IsToolTipEnabled = true;
        }
        public MapControlToolTipService(MapControl mapControl, TileView tileView)
        {
            m_mapControl = mapControl;
            m_hoverTileView = tileView;

            m_content = new TileToolTipControl();
            m_content.DataContext = m_hoverTileView;

            var popup = new ToolTip();
            popup.Content = m_content;
            popup.Placement = System.Windows.Controls.Primitives.PlacementMode.Right;
            popup.HorizontalOffset = 4;
            popup.PlacementTarget = m_mapControl;
            m_popup = popup;

            // Disable the animations, because we lose datacontext during fade-out animation.
            // We need to override the default values in the PlacementTarget control
            m_mapControl.Resources.Add(SystemParameters.ToolTipAnimationKey, false);
            m_mapControl.Resources.Add(SystemParameters.ToolTipFadeKey, false);
            m_mapControl.Resources.Add(SystemParameters.ToolTipPopupAnimationKey, PopupAnimation.None);
        }