ToolTip Visibility not working for PopupButton Content

Ribbon for WPF Forum

Posted 10 years ago by Robert Dyer
Version: 15.1.0620
Platform: .NET 4.5
Environment: Windows 8 (64-bit)
Avatar

I have been working with the Ribbon using the shared PopupButton control. I needed a double line tooltip, and I discovered that this can be done by embedding a StackPanel with two TextBlock controls inside the PopupButton.ToolTip dependency property as follows:

<shared:PopupButton.ToolTip>
     <StackPanel Visibility="{Binding Path=...}}">
          <TextBlock Text="{Binding Path=...}" />
          <TextBlock Text="{Binding Path=...}" />
     </StackPanel>
</shared:PopupButton.ToolTip>

The double line tooltip worked perfectly, except when it needs to be collapsed or hidden. If the TextBlock.Text values are empty, then I do not want the tooltip to be shown. I am using a converter that I called "TextToVisibilityConverter" that sets the visibility of the tooltip's StackPanel to collaped when the text values are empty. This does not work because there is still a small square shaped graphic that is displayed even when the tooltip text vales are empty. I then tried a variation on that using a new converter which I called TextToHiddenVisibilityConverter which sets the tooltip's StackPanel to hidden rather than collapsed when the text is empty. In that case the full sized tooltip is shown albeit with no text. 

I also tried setting the visibility of the individal TextBlocks inside of the tooltip's StackPanel, but that made no difference at all.

Is there some way I would work around this problem? Shouldn't the tooltip be hidden or collapsed when I so specify?

I suppose a work around would be to always have a tooltip displayed and to not fuss with the visibility of the StackPanel control in the tooltip. 

Previously I encountered the same issuue when I used the ribbon PopupButton control. In either case hiding the tooltip does not seem to be possible.

Comments (1)

Posted 10 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Robert,

If you collapse the visibility of the StackPanel, I would imagine that WPF would still show the ToolTip since it has content (the collapsed StackPanel), even though the content will arrange to zero size.

Probably the only way to prevent a tooltip from showing in WPF is to set the ToolTip property itself to null.  Perhaps you could do that instead of trying to alter StackPanel visibility.


Actipro Software Support

The latest build of this product (v24.1.3) was released 2 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.