how to expand a Node by double clicking a row?

1 posts, 0 answers
  1. Xu
    Xu avatar
    4 posts
    Member since:
    Dec 2010

    Posted 23 Feb 2012 Link to this post

    Hi Telerik guys

    just as the title asked, how to expand a node by double clicking a row?

    I am now using RowActivated event to do that, the XAML and the code behind are listed here:
    <telerik:RadTreeListView ItemsSource="{Binding People}"
    AutoGenerateColumns="False"
    RowIndicatorVisibility="Collapsed"
    GridLinesVisibility="None"
    RowHeight="22"
    HierarchyExpandButtonStyle="{StaticResource GridViewToggleButtonStyle1}"
    RowStyle="{StaticResource TreeListViewRowStyle1}"
    EditTriggers="None"
    CanUserFreezeColumns="False"
    ScrollViewer.HorizontalScrollBarVisibility="Disabled"
    BorderBrush="#FF595959"
    BorderThickness="0"
    RowActivated="RadTreeListView_RowActivated">
    private void RadTreeListView_RowActivated(object sender, Telerik.Windows.Controls.GridView.RowEventArgs e)
    {
        var viewRow = e.Row as Telerik.Windows.Controls.TreeListView.TreeListViewRow;
        if (viewRow.IsExpandable && !viewRow.IsExpanded)
        {
            (e.Row as Telerik.Windows.Controls.TreeListView.TreeListViewRow).IsExpanded = true;
        }
        else if (viewRow.IsExpandable && viewRow.IsExpanded)
        {
            (e.Row as Telerik.Windows.Controls.TreeListView.TreeListViewRow).IsExpanded = false;
        }
    }

    is this a correct way? or there is some other better method?

    thanks
Back to Top