Search code examples
wpftooltip

WPF - Tooltips are being clipped to window size


I've seen that WPF tooltips can be shown as being not clipped to the window they're viewed in, but for me they are clipping to the window.

http://wpf.2000things.com/2013/07/17/865-tooltip-can-extend-beyond-window-boundaries/

My results:

<TextBlock Text="?" ToolTip="Denotes if initial dividend calculation will be rounded to nearest $0.01" />

Any ideas why this is showing within the borders of the window? Every other example I can find has the tooltip showing above the window


Solution

  • Much later, I found the solution. Applying the following style will wrap the text, and stop the tooltip from being truncated.

        <Style TargetType="ToolTip">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <StackPanel>
                            <TextBlock Text="{Binding}" TextWrapping="Wrap" />
                        </StackPanel>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>