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

Displaying tooltip for a checkbox on a treeview

5 Answers 93 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Ruth
Top achievements
Rank 1
Ruth asked on 28 Feb 2012, 09:15 PM
Is there a way to display a tool tip when user is hovering around the checkbox on a treeview?

5 Answers, 1 is accepted

Sort by
0
Rahul
Top achievements
Rank 2
answered on 29 Feb 2012, 11:38 AM
Hi Ruth,

            Please check out below code to apply tooltip for checkbox in tree view.

<Grid x:Name="LayoutRoot">
       <Grid.Resources>
           <DataTemplate x:Key="Team">
               <StackPanel Orientation="Horizontal">
                   <CheckBox Click="CheckBox_Click" ToolTipService.ToolTip="Check Me"/>
               <TextBlock Text="{Binding Name}" />
               </StackPanel>
           </DataTemplate>
            
           <telerik:HierarchicalDataTemplate x:Key="Division" ItemTemplate="{StaticResource Team}"
          ItemsSource="{Binding Teams}">
               <TextBlock Text="{Binding Name}" />
           </telerik:HierarchicalDataTemplate>
            
           <telerik:HierarchicalDataTemplate x:Key="League" ItemTemplate="{StaticResource Division}"
          ItemsSource="{Binding Divisions}">
               <TextBlock Text="{Binding Name}" />
           </telerik:HierarchicalDataTemplate>
            
       </Grid.Resources>
       <telerik:RadTreeView Name="radTreeView"  ItemTemplate="{StaticResource League}">
            
       </telerik:RadTreeView>
   </Grid>


Thanks & Regards
Rahul
0
Petar Mladenov
Telerik team
answered on 02 Mar 2012, 12:42 PM
Hi Rahul,

 We are glad to know that you have found a way to achieve this functionality. In the attached project you can find another approach - the default template of the RadTreeViewItem is extracted from Blend and the same Tooltip  is applied in the ChechBoxElement:

<CheckBox ToolTipService.ToolTip="Check Me"
                          x:Name="CheckBoxElement" Grid.Column="2"
                          IsTabStop="False" Margin="5,0,0,0"
                          telerik:StyleManager.Theme="{StaticResource Theme}
                    " Visibility="Collapsed"
                          VerticalAlignment="Center"/>
 

All the best,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ruth
Top achievements
Rank 1
answered on 05 Mar 2012, 06:53 PM
Rahul and Petar,

Thank you for your code samples.

Rahul - I need to see a tool tip when user is hovering over the checkbox without actually clicking it.

Petar - I am trying not to have a checkbox in a data template. I would prefer to utilize
IsTriStateMode="True" IsOptionElementsEnabled="True" ItemsOptionListType="CheckList" 
to display a checkbox on a treeview. Is it still possible to display a tool tip for a checkbox?
0
Petar Mladenov
Telerik team
answered on 06 Mar 2012, 12:37 PM
Hello Ruth ,

 So I guess the project I attached is just what you need. Please note that I have used the default TriState Behavior and I have not included CheckBox in the ItemsTemplate:

<Grid.Resources>
          <telerik:HierarchicalDataTemplate x:Key="itemtemplate" ItemsSource="{Binding Children}" >
              <TextBlock Text="{Binding Name}" />
          </telerik:HierarchicalDataTemplate>
      </Grid.Resources>
 
      <telerik:RadTreeView x:Name="tree"
                           IsExpandOnSingleClickEnabled="false"
                           IsLineEnabled="True"
                           IsOptionElementsEnabled="True"
                           IsTriStateMode="True" ItemTemplate="{StaticResource itemtemplate}" />
Do not hesitate to ask if  you need further assistance.

Greetings,
Petar Mladenov
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Ruth
Top achievements
Rank 1
answered on 06 Mar 2012, 11:42 PM
Thank you, Petar!
Tags
TreeView
Asked by
Ruth
Top achievements
Rank 1
Answers by
Rahul
Top achievements
Rank 2
Petar Mladenov
Telerik team
Ruth
Top achievements
Rank 1
Share this question
or