This is a migrated thread and some comments may be shown as answers.

how to expand a Node by double clicking a row?

0 Answers 66 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Xu
Top achievements
Rank 1
Xu asked on 23 Feb 2012, 08:29 PM
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

No answers yet. Maybe you can help?

Tags
TreeListView
Asked by
Xu
Top achievements
Rank 1
Share this question
or