How to disable tooltip for the first node of RadTreeView

3 posts, 0 answers
  1. Divya
    Divya avatar
    6 posts
    Member since:
    Apr 2014

    Posted 01 Oct 2014 Link to this post

    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. Petar Mladenov
    Admin
    Petar Mladenov avatar
    2891 posts

    Posted 02 Oct 2014 Link to this post

    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.
     
  3. UI for WPF is Visual Studio 2017 Ready
  4. Divya
    Divya avatar
    6 posts
    Member since:
    Apr 2014

    Posted 07 Oct 2014 in reply to Petar Mladenov Link to this post

    Thank you...

    I was able to resolve the issue using ItemContainerStyle.

    Divya
Back to Top