Did somebody have had a treeview where the treeviewitems collapse at the first time one of its subitems is selected and only after expanding the item a second time its subitems remain visible? I have four treeviews with the same ItemContainerStyle and the same ItemTemplate. Three of them work normal, but only one have shown this weird behaviour.
Besides this weird behaviour, in the first time the subitems are shown, they don't raises events like mousemove or mousedown. I have checked that this events have been subscribed before the first exhibition.
Below is the treeview definition in xaml:
<TabItem Header="Composições" Tag="{Binding ElementName=tvComposites, Path=SelectedItem}"><DockPanel LastChildFill="True"><Canvas DockPanel.Dock="Top" Name="CanvasComp"><TreeView Name="tvComposites" ItemsSource="{Binding CompositeResources.Children}"
Width="{Binding ActualWidth, ElementName=CanvasComp}" Height="{Binding ActualHeight, ElementName=CanvasComp}"><TreeView.ItemContainerStyle><Style TargetType="{x:Type TreeViewItem}"><Setter Property="local:Util.BringIntoViewOnSelected" Value="True"/><Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" /><Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" /></Style></TreeView.ItemContainerStyle><TreeView.ItemTemplate><HierarchicalDataTemplate ItemsSource="{Binding Children}"><DockPanel LastChildFill="True"><Border Name="SelectionBorder" BorderThickness="1" ><ContentPresenter Content="{Binding}"/></Border></DockPanel><HierarchicalDataTemplate.Triggers><DataTrigger Binding="{Binding IsSelected}" Value="True"><Setter TargetName="SelectionBorder" Property="Background" Value="Gray"/></DataTrigger><DataTrigger Binding="{Binding IsSelected}" Value="False"><Setter TargetName="SelectionBorder" Property="Background" Value="Transparent"/></DataTrigger></HierarchicalDataTemplate.Triggers></HierarchicalDataTemplate></TreeView.ItemTemplate></TreeView></Canvas></DockPanel></TabItem>Thanks for any help.
Danilo
Codelines