Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1405
ToolTip on the header of a ContentPane
posted

Hy.

I am using XamDockManager on which I add ContentPanes with different functionalities. For every ContentPane that I add I would like to have a different tooltip, but I don't know how to set the tooltip for the header of the ContentPane. How can this be done in code? The ContentPane has a property called ToolTip but this does not show the tooltip when you go over the header of the ContentPane.

Thanks very much for any suggestion.

Nico

Parents
  • 54937
    Offline posted

    ToolTip is a property defined on FrameworkElement so pretty much every element has this property. The ContentPane ultimately derives from FrameworkElement so it has this property. When you set an element's ToolTip, the WPF framework will show it whenever you hover anywhere over that element - assuming you don't hover over an element within it that has a tooltip (like the caption buttons). The element that represents the caption is the PaneHeaderPresenter so if you don't want these tooltips then you will probably have to retemplate that element so that it doesn't set the ToolTip on its buttons.If you just want a tooltip on the caption when not over the buttons, you probably need to retemplate the ContentPane and set the ToolTip on the PaneHeaderPresenter in its template. Another possibility instead of the latter would be to set the HeaderTemplate of the ContentPane to a DataTemplate that has a TextBlock in it with its tooltip property set.
    e.g. I'm just binding to the Name property of the pane but you could bind to something else.

    <igDock:ContentPane x:Name="leftBottom" Header="Left Bot">
        <igDock:ContentPane.HeaderTemplate>
            <DataTemplate>
                <TextBlock Text="{Binding}" 
                       ToolTip="{Binding Path=Name, RelativeSource={RelativeSource AncestorType={x:Type igDock:ContentPane}}}" 
                       />
            </DataTemplate>
        </igDock:ContentPane.HeaderTemplate>
        <Button>Left Bot</Button>
    </igDock:ContentPane>

     

Reply Children