LoadOnDemand changing CheckState

2 posts, 0 answers
  1. Drew
    Drew avatar
    5 posts
    Member since:
    Aug 2011

    Posted 25 Aug 2011 Link to this post

    I have created the following RadTreeView:

    <Style TargetType="telerik:RadTreeViewItem" x:Key="RadTreeViewItemStyle">
        <Setter Property="CheckState" Value="{Binding Path=CheckState, Mode=TwoWay, Converter={StaticResource ToggleStateToBoolean}}" />
        <Setter Property="DefaultImageSrc" Value="{Binding ListImage}" />
        <Setter Property="IsExpanded" Value="{Binding IsExpanded}" />
        <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
    <HierarchicalDataTemplate x:Key="TreeViewItemTemplate" ItemsSource="{Binding DirectoryList}" ItemContainerStyle="{StaticResource RadTreeViewItemStyle}">
        <TextBlock Text="{Binding DisplayName}"  Margin="0,0,5,0"/>
            <telerik:RadTreeView Grid.Column="0" IsLineEnabled="True" ItemsOptionListType="CheckList" IsOptionElementsEnabled="True" IsTriStateMode="True"
                                 BorderBrush="Black" BorderThickness="1" ItemsSource="{Binding RootItems}" ItemTemplate="{StaticResource TreeViewItemTemplate}"
                                 IsLoadOnDemandEnabled="True" LoadOnDemand="RadTreeView_LoadOnDemand" ItemContainerStyle="{StaticResource RadTreeViewItemStyle}"
                                 Background="White" Name="ExplorerTree">

    In the codebehind, I am passing the LoadOnDemand back to my viewmodel for processing.  Everything is working exactly as it should except for when I attempt to load a node that has been selected.  If I select the node and then fire the LoadOnDemand event, it loads properly and displays all the child nodes, but then deselects the node itself.  How can I get it to stop doing this?

  2. Petar Mladenov
    Petar Mladenov avatar
    3151 posts

    Posted 31 Aug 2011 Link to this post

    Hello Drew,

    Can you confirm that the node that is expanded on Load operation is deselected ? The RadTreeViewItem has two selected states: SelectionFocused and SelectionUnfocused. If the node gets unfocussed after the load operation but it is still selected , you can invoke the Focus() method on it in the LoadOnDemand event handler. Is this suitable for you? If this is not the case, it would be easier for us if we can view more from your code. You can also open a new support thread with a project attached. Thank you for your cooperation.

    All the best,
    Petar Mladenov
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Back to Top