Hide tooltip if binding is null

后端 未结 6 622
情深已故
情深已故 2021-02-01 14:33

Currently i\'ve got the following code to show a tooltip.



        
6条回答
  •  旧时难觅i
    2021-02-01 15:36

    If just using the default tooltip I would otherwise recommend either setting the bound value to null in the viewmodel or using a converter whenever the item is empty.

    In my case I've got a:

    public string Name { get; }
    

    Bound using:

    
    

    Where the idea is to show the full name in the tooltip if cut of due to lack of width. In my viewmodel I simply:

    if (string.IsNullOrEmpty(Name)) Name = null;
    

    At least in .Net 4.0 this will not show a tooltip for me.

提交回复
热议问题