This is a migrated thread and some comments may be shown as answers.

RadPane Header Tooltip from code behind

5 Answers 207 Views
Docking
This is a migrated thread and some comments may be shown as answers.
Dean Wyant
Top achievements
Rank 1
Dean Wyant asked on 12 Sep 2011, 03:46 PM
I am using abreviated text for the Header/Title and I am trying to set the tooltip for the Header and the tab to the complete text.

I know the TitleTemplate, HeaderTemplate can be used to add tooltips for the title bar and tabs using xaml. However, I need to set tooltips in C# code.

I can add a tooltip to the tab in code behind by

ToolTipService

 

 

.SetToolTip(MyRadPane, Tip);

 

I cannot find a DependencyObject (PaneHeader?) that I can access to set a tooltip for the Header text area.

How do I add a tooltip to the title bar Header text area from code behind?

5 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 15 Sep 2011, 11:56 AM
Hello Dean,

You could set the template of the header in code behind and add there the tooltip. In that way you will be able to
set the ToolTip in code behind.

Hope this information helps.

All the best,
Konstantina
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Dean Wyant
Top achievements
Rank 1
answered on 16 Sep 2011, 02:14 PM
I know I can set the tooltip in a template like so: 

The resource is:

 

 

<DataTemplate x:Key="MyTabTemplate">

 

 

 

<ContentPresenter Content="{Binding}" Margin="2,0,0,0" >

 

 

 

<ToolTipService.ToolTip>

 

 

 

<ToolTip Content="{Binding}"></ToolTip>

 

 

 

</ToolTipService.ToolTip>

 

 

 

</ContentPresenter>

 

 

 

</DataTemplate>

 


Code:
HeaderTemplate = ((MainPage)App.Current.RootVisual).Resources["MyTabTemplate"] as DataTemplate;

More code:
string sTip = "My Tooltip is dynamic: " + dynamicTip;

ToolTipService

 

 

.SetToolTip(this, sTip); // Sets the tab tooltip
ToolTipService.SetToolTip(?, sTip); // How do I set the header tooltip????

>>>that way you will be able to
set the ToolTip in code behind.

How???

Thanks.

 






0
Konstantina
Telerik team
answered on 21 Sep 2011, 12:43 PM
Hi Dean,

Setting the tooltip from code behind is very difficult task. Instead I can suggest you the following solution:
- using the MVVM approach define a property for the content of the ToolTip or for the Text property of a TextBlock in the Tooltip.
- define both HeaderTemplate and TitleTemplate in XAML and add there the ToolTip.
- when you need to change the value of the Tooltip just change the properties in the ViewModel instead of the DataTemplates themselves.

Best wishes,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
0
Dean Wyant
Top achievements
Rank 1
answered on 22 Sep 2011, 02:25 PM
Unfortunately, I do not know how to do that.
0
Konstantina
Telerik team
answered on 26 Sep 2011, 11:34 AM
Hi Dean,

Please find attached a sample project in which this is illustrated.

Hope this helps.

Greetings,
Konstantina
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Tags
Docking
Asked by
Dean Wyant
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Dean Wyant
Top achievements
Rank 1
Share this question
or