I want whenever an item is added for it to start expanded.
My treeview is bound to a viewmodel.
I am using code examples from the forums to bind the isexpanded to a viewmodel isexpanded property like below.
The code worked for a bit and then recently stopped . the treeview does not render at all if the style is applied. if I remove the style it works fine.
Any ideas. is there a simpler way to do it .
Any help would be appreciated.
<Style TargetType="{x:Type telerik:RadTreeViewItem}" x:Key="Cola" > <Setter Property="IsSelected" Value="{Binding Path=IsSelected,Mode=TwoWay}" /> <Setter Property="IsExpanded" Value="{Binding Path=IsExpanded,Mode=TwoWay}"/></Style>
<telerik:RadTreeView Grid.Row="0" Grid.Column="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Margin="4" SelectedItem="{Binding SelectedTreeViewModel,Mode=TwoWay}" ItemContainerStyle="{StaticResource Cola}" ItemsSource="{Binding TreeViewModels}" > <telerik:RadTreeView.ItemTemplate> <HierarchicalDataTemplate ItemsSource="{Binding TreeViewModels}" > <StackPanel Orientation="Horizontal" > <Image Source="{Binding Image}" Height="16" Width="16" VerticalAlignment="Center" /> <TextBlock Text="{Binding Name}" Margin="4,0,0,0" VerticalAlignment="Center" /> </StackPanel> </HierarchicalDataTemplate> </telerik:RadTreeView.ItemTemplate> </telerik:RadTreeView>