Show WPF Tooltip if needed

前端 未结 3 669
粉色の甜心
粉色の甜心 2020-12-13 07:12

I have a TextBlock inside a limited-size control. If the text is too long to fit into the control, I\'d like to show a tooltip with full text. This is a classic behavior you

3条回答
  •  心在旅途
    2020-12-13 07:28

    I figured it out, the Tooltip has PlacementTarget property that specifies the UI element that has the Tooltip. In case anyone needs it:

    
        
            
                   
             
        
    
    

    And then write a Converter that converts TextBlock to Visibility (based on TextBlock width).

提交回复
热议问题