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

How to disable tooltip for the first node of RadTreeView

2 Answers 166 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Divya
Top achievements
Rank 1
Divya asked on 01 Oct 2014, 09:09 AM
Hi,

I have defined a custom tooltip for RadTreeView. Also I have used HierarchicalDataTemplate for my RadTreeView. Code is as shown below.

 <telerik:RadTreeView Margin="8" IsDragDropEnabled="True"  Name="CollExperimentTreeView"  SelectedItem="{Binding ActiveExp, Mode=TwoWay}"
     SelectionMode="Single" IsSingleExpandPath="False" IsLineEnabled="True"   VerticalAlignment="Stretch"
       temTemplate="{StaticResource TreeViewTemplate}"  ItemsSource ="{Binding TreeViewCollection,  Mode=TwoWay}" />

Custom tooltip and  HierarchicalDataTemplate  defined as below:

 <UserControl.Resources>
        <Style TargetType="{x:Type telerik:RadTreeViewItem}">
            <Setter Property="ToolTip" >
                <Setter.Value>
                    <ToolTip>
                        <ToolTip.Content>
                            <StackPanel Orientation="Vertical">
                                <StackPanel Orientation ="Horizontal">
                                    <TextBlock Text="Started:   " />
                                    <TextBlock Text="{Binding StartDate}" />
                                </StackPanel>
                                <StackPanel Orientation ="Horizontal">
                                    <TextBlock Text="Last Changed:   " />
                                    <TextBlock Text="{Binding LastAccess}" />
                                </StackPanel>
                                <TextBlock Text="{Binding Description}" />
                            </StackPanel>
                        </ToolTip.Content>
                    </ToolTip>
                </Setter.Value>
            </Setter>
        </Style>
        <HierarchicalDataTemplate x:Key="TreeViewTemplate" ItemsSource="{Binding Path=Experiments}">
            <TextBlock VerticalAlignment="Stretch" HorizontalAlignment="Stretch"  Text="{Binding Name}" />              
        </HierarchicalDataTemplate>
    </UserControl.Resources>

I do not want to display tooltip for those nodes that shows TextBlock containing Name,( HierarchicalDataTemplate )  

Please help

Thanks

2 Answers, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 02 Oct 2014, 06:22 AM
Hi Divya,

You can use ItemContainerStyleSelector which will set Style will ToolTip on certain items and style with no tooltips on the other TreeViewItems. For the normal style you can just return base.SelectStyle in the StyleSelector class. We hope the following help article is a good starting point.

RadTreeView ItemContainerStyleSelector

Please let us know if you need further assistance with this requirement.

Regards,
Petar Mladenov
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Divya
Top achievements
Rank 1
answered on 07 Oct 2014, 06:26 AM
Thank you...

I was able to resolve the issue using ItemContainerStyle.

Divya
Tags
TreeView
Asked by
Divya
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Divya
Top achievements
Rank 1
Share this question
or