As HB says, you should not put a TreeViewItem inside your hierarchical data template, since WPF will automatically create it to pack your content.
If you want to bind to a ToolTip, you can do this inside an ItemContainerStyle that will apply to all of your treeview items in the TreeView.
<TreeView .... your parameters > <TreeView.ItemContainerStyle> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="ToolTip" Value="{Binding ToolTipText}"/> </Style> </TreeView.ItemContainerStyle> </TreeView>
Hope this helps.
Although I have not tested it, I think your hierarchical data template should look like this:
<HierarchicalDataTemplate DataType="{x:Type local:TreeItem}" ItemsSource="{Binding Path=Children}" > <StackPanel Orientation="Horizontal"> <Image Width="16" Height="16" Margin="3,0"> <Image.Source> <Binding Path="IsLeaf" Converter="{StaticResource cnvIsBooleanToStringArrayItemConverter}"> <Binding.ConverterParameter> <x:Array Type="sys:String"> <sys:String>..\Images\document_plain.png</sys:String> <sys:String>..\Images\folder.png</sys:String> </x:Array> </Binding.ConverterParameter> </Binding> </Image.Source> </Image> <TextBlock MaxWidth="300" Text="{Binding Desc}"/> </StackPanel> </HierarchicalDataTemplate>
source share