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
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.
Hy Andrew.
Thanks very much for the answer. I tried this example with the DataTemplate for the header of the ContentPane but the ToolTip for the TextBlock it's not displayed. I have no idea why.
I tested the snippet I provided and it worked for me. Are you doing this in a simple sample? If so, can you post it here so I can try it? If you're only getting this problem in your application then you will probably need to reduce it down and submit it to the support group.
I have a simple sample in which I use the XamDockManagaer. I attached it. I can't se why the tooltip it's not displayed. Maybe is there a setting and I don't see it.
Thanks very much.
I didn't realize you were talking about doing this within the DocumentContentHost. When a ContentPane is within a DCH, it doesn't show its header. Instead, a PaneTabItem is created that represents the header portion. That is also why you didn't see a tooltip when you set it on the ContentPane because the tab item isn't part of the ContentPane - the ContentPane is in essence the content of that tab item. So in this case you need to set the TabHeaderTemplate and in order to get to the ContentPane, you need to use the Pane property of the PaneTabItem.E.g.
I think you may have misunderstood what I put. I indicated that you would put a Style (not a ControlTemplate) for the PaneHeaderPresenter. That style would not have a key and would have a setter that would set the Template property to your control template. That being said, I reread through your posts because your template confused me. If you used the template you showed then the header of the pane would be a single button - no caption, no other buttons, etc. Perhaps I misunderstood your original post. If you want to add a menu item to the Window Position menu then you can handle the OptionsMenuOpening and add your menu item there. Note, this event is fired for the "Window Position" dropdown as well as the context menu for the pane (i.e. when you right click on the pane header or pane tab item). If you are really trying to add a button next to the Window Position menu then you have 2 possibilities. One is to follow the route you are on and retemplate the PaneHeaderPresenter to include the extra button. You would need to include more stuff in that template and you would probably be best served using the default template for the PaneHeaderPresenter; there is a DefaultStyles folder in the install folder that includes the xaml files with the default styles. The other option is to define a HeaderTemplate that includes the button (as well as a TextBlock for the caption). There are some other posts asking about similar things regarding the TabHeaderTemplate that you could use as a starting point.
Hi Andrew,
I tried the below syntax for retemplating the PaneHeaderPresenter. I did not see any change in the header of the pane though. Can you provide an example of this or correct my mistake in the below code snippet. I am new to WPF and Infragistics controls and trying these for the first time as there is a requirement.
<igDock:ContentPane Name="Portlet5" Header="My Portlet" >
<ControlTemplate x:Key="PaneHeaderPresenterControlTemplate1" TargetType="{x:Type igDock:PaneHeaderPresenter}">
</ControlTemplate>
</igDock:ContentPane>
</igDock:SplitPane>
If I remove the key property, it gives me the below error.
Error 2 All objects added to an IDictionary must have a Key attribute or some other type of key associated with them. Line 49 Position 16. C:\Projects\appanara_aps_CreditRisk_main_ws\depot\CreditRiskIT\Portal\_trunk\_main.br\Code\Barcap.CR.Portal\Barcap.CR.Portal.UI\HomePageControl.xaml 49 16 Barcap.CR.Portal.UI
Thanks,
Ravi.
You don't actually want to set the Content of the pane to be a PaneHeaderPresenter. You just want to put the Style for the PaneHeaderPresenter (without a key) into the Resources of the ContentPane.
Thanks for the response. I tried modifying the template for PaneHeaderPresenter as below. This shows the button in the content instead of the header. I tried modifying the HeaderTemplate to achieve this. However, when I choose the DockPanel position to be right for the button, it comes in the center. I am looking to have the button to the left of window position button. Is this achievable.
<UserControl.Resources> <ControlTemplate x:Key="PaneHeaderPresenterControlTemplate1" TargetType="{x:Type igDock:PaneHeaderPresenter}"> <Button x:Name="personalizeButton" CommandParameter="{TemplateBinding Pane}" HorizontalAlignment="Right" Click="personalize_Click">Personalize</Button> </ControlTemplate> </UserControl.Resources>
....... <igDock:SplitPane> <igDock:ContentPane Name="Portlet5" Header="My Header"> <igDock:PaneHeaderPresenter DockPanel.Dock="Top" Template="{DynamicResource PaneHeaderPresenterControlTemplate1}"> </igDock:PaneHeaderPresenter> </igDock:ContentPane> </igDock:SplitPane>
.......
You would more likely retemplate the PaneHeaderPresenter such that it contains another button which uses your command. Put the style for the PaneHeaderPresenter into the Resources of the ContentPane and handle the command bindings for your command on the contentpane.