Пример #1
0
        async void Pin_ToolTipOpening(object sender, ToolTipEventArgs e)
        {
            if (IsToolTipLocationSet) return;

            Pin.ToolTip = "Finding Location...";
            Location location = new Location(Coordinate.LatDecimal.Value, Coordinate.LonDecimal.Value);

            Task<LocationResult> t = Task.Factory.StartNew<LocationResult>(() =>
            {
                return BingMapsService.findLocation(location, BingMapsKey.SessionKey);
            });

            try
            {
                await t;

                if (t.Result != null)
                {
                    Pin.ToolTip = t.Result.Name;
                    IsToolTipLocationSet = true;
                }
                else
                {
                    Pin.ToolTip = "Unknown location";
                    IsToolTipLocationSet = false;
                }

            }
            catch (Exception ex)
            {
                Pin.ToolTip = "Error: " + ex.Message;
                IsToolTipLocationSet = false;
            }
        }
Пример #2
0
 protected override void OnToolTipOpening(ToolTipEventArgs e)
 {
     if (TextTrimming != TextTrimming.None)
     {
         e.Handled = !IsTextTrimmed();
     }
 }
Пример #3
0
		protected override void OnToolTipOpening(ToolTipEventArgs e) {
			if (ToolTip == toolTipDummy) {
				ToolTip = Node.ToolTip;
				if (ToolTip == null)
					e.Handled = true;
			}
			base.OnToolTipOpening(e);
		}
 private void Button_ToolTipOpening(object sender, ToolTipEventArgs e)
 {
     // ... Set ToolTip on Button before it is shown.
     Button room = sender as Button;
     char[] roomName = room.Name.ToCharArray();
     char[] roomNumber = {roomName[6], roomName[7], roomName[8]};
     String roomNo = new String(roomNumber);
     room.ToolTip = "Status of room "+roomNo+": \n";
 }
            private void OnToolTipOpening(object sender, ToolTipEventArgs e)
            {
                _foregroundObject.AssertIsForeground();

                Debug.Assert(_textBlock.ToolTip == this);
                Debug.Assert(_disposableToolTip == null);

                _disposableToolTip = _createToolTip();
                _textBlock.ToolTip = _disposableToolTip.ToolTip;
            }
        public static void OnToolTipOpening(object sender, ToolTipEventArgs e)
        {
            var checkBox = sender as CheckBox;

            if (checkBox != null)
            {
                checkBox.Measure(new Size(Double.PositiveInfinity, Double.PositiveInfinity));
                if (checkBox.ActualWidth >= checkBox.DesiredSize.Width)
                    e.Handled = true; // no tooltips when text is fully displayed
            }
        }
            private void OnToolTipClosing(object sender, ToolTipEventArgs e)
            {
                _foregroundObject.AssertIsForeground();

                Debug.Assert(_disposableToolTip != null);
                Debug.Assert(_textBlock.ToolTip == _disposableToolTip.ToolTip);

                _textBlock.ToolTip = this;

                _disposableToolTip.Dispose();
                _disposableToolTip = null;
            }
Пример #8
0
        public static void ICmdTooltip(Object sender, ToolTipEventArgs e)
        {
            if (sender is ICommandSource == false || sender is FrameworkElement == false) return;

            ICommand icmd = (sender as ICommandSource).Command ;
            CtxmCode code = ((sender as ICommandSource).CommandParameter as EpgCmdParam).Code;
            var obj = sender as FrameworkElement;
            obj.ToolTip = mm.IsGestureEnableOnView(icmd, code) == true ? null : GetInputGestureText(icmd);
            obj.ToolTip = obj.ToolTip == null ? "" : obj.ToolTip;
            if (obj.ToolTip as string == "")
            {
                e.Handled = true;
            }
        }
    /// <summary>
    /// handle the tooltip opening
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    private void UpdateStatusOpenTip(object sender, ToolTipEventArgs e)
    {
      e.Handled = true;

      if (e.Source is FrameworkElement)
      {
        FrameworkElement fe = e.Source as FrameworkElement;
        string tooltip = fe.ToolTip as string;

        // do nothing if null
        if (null == tooltip)
          return;       

        MetadataEditorControl me = Utils.GetMetadataEditorControl(fe);
        me.UpdateStatus(tooltip);
      }
    }
Пример #10
0
 private static void OnToolTipClosingThunk(object sender, ToolTipEventArgs e)
 { 
     ((FrameworkContentElement)sender).OnToolTipClosing(e); 
 }
Пример #11
0
 /// <summary>
 ///     Called when the ToolTipOpening event fires. 
 ///     Allows subclasses to add functionality without having to attach 
 ///     an individual handler.
 /// </summary> 
 /// <param name="e">Event arguments</param>
 protected virtual void OnToolTipOpening(ToolTipEventArgs e)
 {
 } 
 /// <summary>
 /// Handles the event which occurs just before a pie piece tooltip opens
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void PiePieceToolTipOpening(object sender, ToolTipEventArgs e)
 {
     PiePiece piece = (PiePiece)sender;
     ToolTip tip = (ToolTip)piece.ToolTip;
     tip.Content = (string)piece.Tag;
 }
Пример #13
0
 private void StudentsGroupsDataGrid_ToolTipClosing(object sender, ToolTipEventArgs e)
 {
     StudentsGroupsDataGrid.ToolTip = null;
 }
 private void FrameworkElement_OnToolTipClosing(object sender, ToolTipEventArgs e)
 {
     QueriesSummaryOpacity = 1;
 }
Пример #15
0
 private void txtDisplayName_ToolTipOpening(object sender, ToolTipEventArgs e)
 {
     var trimmed = CalculateIsTextTrimmed(txtDisplayNameDummy);
     //var trimmed = CalculateIsTextTrimmed(sender as TextBlock);
     if (trimmed)
     {
         var tt = Resources["DisplayNameTooltip"] as ToolTip;
         // Find the TextBlock from within the Tooltip Template that will display our Game text
         var ttTextBlock = (tt.Content as Border).Child as TextBlock;
         // Then give it the full Game text to display
         ttTextBlock.Text = ((sender as TextBlock).DataContext as Toast).DisplayName;
     }
     // Set Handled if we dont need the Tooltip so no empty Tooltip appears
     e.Handled = !trimmed;
 }
Пример #16
0
        /// <summary>
        /// Handles the event which occurs just before a pie piece tooltip opens
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void PiePieceToolTipOpening(object sender, ToolTipEventArgs e)
        {
            PiePiece piece = (PiePiece)sender;

            CollectionView collectionView = (CollectionView)CollectionViewSource.GetDefaultView(this.DataContext);
            if (collectionView == null)
                return;

            // select the item which this pie piece represents
            int index = (int)piece.Tag;
            if (piece.ToolTip != null)
            {
                ToolTip tip = (ToolTip)piece.ToolTip;
                tip.DataContext = collectionView.GetItemAt(index);
            }
        }
Пример #17
0
			protected override void OnToolTipOpening(ToolTipEventArgs e)
			{
				base.OnToolTipOpening(e);
				var marker = FindNextMarker(Mouse.GetPosition(this));
				if (marker != null && marker.ToolTip != null) {
					this.ToolTip = marker.ToolTip;
				} else {
					// prevent tooltip from opening
					e.Handled = true;
				}
			}
Пример #18
0
        private void Hyperlink_ToolTipOpening(object sender, ToolTipEventArgs e)
        {
            var hyperlink = (Hyperlink)sender;
            if (hyperlink.ToolTip is string)
            {
                hyperlink.ToolTip = new TextBlock { Text = (string)hyperlink.ToolTip };
                ThreadPool.QueueUserWorkItem(tag =>
                {
                    var url = (string)tag;
                    string url2 = url;
                    //goo.gl反解析
                    if (Regex.IsMatch(url, @"http://goo\.gl\/([A-Za-z0-9/]+?)"))
                    {
                        var gh = MiniTwitter.Net.TwitterClient.googlHelper;
                        url2 = gh.GetOriginalUrl(url);
                        if (Settings.Default.AntiShortUrlTracking && url2 != url)
                        {
                            this.Invoke(() => hyperlink.Tag = url2);
                        }
                    }
                    if (Regex.IsMatch(url, @"http://((bit\.ly)|(j\.mp))/[A-Za-z0-9]+?"))
                    {
                        url2 = MiniTwitter.Net.BitlyHelper.ConvertFrom(url);
                        if (Settings.Default.AntiShortUrlTracking && url2 != url)
                        {
                            this.Invoke(() => hyperlink.Tag = url2);
                        }
                    }
                    if (Regex.IsMatch(url, @"http://cli\.gs/[A-Za-z0-9]+"))
                    {
                        try
                        {
                            url2 = (new WebClient()).DownloadString("http://cli.gs/api/v1/cligs/expand?clig=" + url);
                        }
                        catch
                        {
                            url2 = url;
                        }
                    }
                    try
                    {
                        var location = GetRedirect(url2);

                        if ((!location.IsNullOrEmpty() && location == url) || redirectFailCount > 5)
                            this.Invoke(() =>
                            {
                                hyperlink.ToolTip = new TextBlock { Text = location };
                                hyperlink.Tag = location;       //无论如何都防止产生两次点击
                                CacheUrl(((Run)hyperlink.Inlines.FirstInline).Text, location);
                            });
                        else
                            this.Invoke(() =>
                            {
                                redirectFailCount++;
                                hyperlink.ToolTip = IsUrl(location) ? location : url;
                            });
                    }
                    catch { }
                }, hyperlink.Tag);
                e.Handled = true;
                //if (hyperlink.ToolTip == null)
                //{
                //    e.Handled = true;
                //}
            }
        }
Пример #19
0
 private void bfc_ToolTipOpening(object sender, ToolTipEventArgs e)
 {
     bfc.ToolTip = ToolTipContent;
 }
Пример #20
0
 private void FieldtooltipToolTipOpening(object sender, ToolTipEventArgs e)
 {
 }
Пример #21
0
 private async void Item_OnToolTipOpening(object sender, ToolTipEventArgs e)
 {
     var sp = sender as FrameworkElement;
     if (null != sp)
     {
         var fi = sp.DataContext as FolderItem;
         if (null != fi && fi.IsImage)
         {
             await fi.LoadImage();
             sp.ToolTip = new Image {Source = fi.ImageSource};
         }
     }
 }
Пример #22
0
 /// <summary>
 ///     Called when the ToolTipClosing event fires.
 ///     Allows subclasses to add functionality without having to attach
 ///     an individual handler. 
 /// </summary>
 /// <param name="e">Event arguments</param> 
 protected virtual void OnToolTipClosing(ToolTipEventArgs e) 
 {
 } 
Пример #23
0
 void FileDropsLBI_ToolTipOpening(object sender, ToolTipEventArgs e)
 {
 }
Пример #24
0
        protected override void OnToolTipOpening(ToolTipEventArgs e)
        {
            base.OnToolTipOpening(e);

            EnsureToolTipContent();
        }
 private void OnToolTipOpening(object sender, ToolTipEventArgs e)
 {
     WpfUtils.OnToolTipOpening(sender, e);
 }
Пример #26
0
 private void buttonPlay_1_ToolTipOpening(object sender, ToolTipEventArgs e)
 {
    
     
 }
Пример #27
0
        /// <summary>
        ///     Initiates the process of opening the tooltip popup.
        /// </summary>
        /// <param name="fromKeyboard">
        ///     Whether this particular event is caused by keyboard focus.
        ///     This is passed down to the tooltip and the popup to determine its placement.
        /// </param>
        private void RaiseToolTipOpeningEvent(bool fromKeyboard = false)
        {
            ResetToolTipTimer();

            if (_forceCloseTimer != null)
            {
                OnForceClose(null, EventArgs.Empty);
            }

            DependencyObject o = LastObjectWithToolTip;

            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.Opened      += OnToolTipOpened;
                    _currentToolTip.Closed      += OnToolTipClosed;
                    _currentToolTip.FromKeyboard = fromKeyboard;
                    _currentToolTip.IsOpen       = true;

                    ToolTipTimer          = new DispatcherTimer(DispatcherPriority.Normal);
                    ToolTipTimer.Interval = TimeSpan.FromMilliseconds(ToolTipService.GetShowDuration(o));
                    ToolTipTimer.Tick    += new EventHandler(OnRaiseToolTipClosingEvent);
                    ToolTipTimer.Start();
                }
            }
        }
Пример #28
0
 private void CharMapButton_ToolTipOpening(object sender, ToolTipEventArgs args)
 {
     FrameworkElement obj = sender as FrameworkElement;
     if (obj != null)
     {
         ToolTipService.SetPlacement(obj, System.Windows.Controls.Primitives.PlacementMode.Relative);
         ToolTipService.SetVerticalOffset(obj, obj.ActualHeight + 6);
     }
 }
Пример #29
0
 private static void OnToolTipOpeningThunk(object sender, ToolTipEventArgs e) 
 { 
     ((FrameworkElement)sender).OnToolTipOpening(e);
 } 
Пример #30
0
 private void btn_ToolTipOpening(object sender, ToolTipEventArgs e) {
   if (sender is SplitButton) {
     if ((sender as SplitButton).IsDropDownOpen) {
       e.Handled = true;
     }
   }
 }
Пример #31
0
 void FileDropsLBI_ToolTipClosing(object sender, ToolTipEventArgs e)
 {
     e.Handled = true;
 }