WPF ToolTip does not update

前端 未结 5 1382
孤城傲影
孤城傲影 2020-12-17 17:21

Assuming I have a simple class that represents a staff member

class Staff
{
    public string FirstName { get; set; }
    public string FamilyName { get; set         


        
5条回答
  •  春和景丽
    2020-12-17 18:06

    This example shows how to add a tooltip to a grid that recalculates the tooltip on demand, when the user hovers over a cell in the grid.

    This is useful if you have a huge grid with 10,000 items, and you want to update the grid continuously - but you don't want to update the tooltips continuously, as this is time consuming.

    This example is for Infragistics, but the principle applies equally to other fine libraries such as DevExpress.

    Xaml

    
        
            
                
            
        
        
            
                
                    
                        
                    
                    
                        
                            
                        
                    
                
            
        
    
    

    ViewModel

    public ICommand ToolTipHoverRefreshCommand => new DelegateCommand(() =>
    {
        this.OnPropertyChanged(this.ToolTip);
    });  
    
    public string ToolTip
    {
        get
        {
            return DateTime.Now.ToString();
        }
        set
        {
            this.OnPropertyChanged(nameof(this.ToolTip));
        }
    }
    

提交回复
热议问题