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

Expand and Collapse from code

1 Answer 87 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
JungTae
Top achievements
Rank 1
JungTae asked on 16 Nov 2010, 07:47 PM

Posted 2 hours ago (permalink)

Hello Telerik community, I have a very simple question which I can't seem to resolve on my own for some reason. When my program used to use telerik RadGridView control, I had this code to expand and collapse my datagrid

private void expandCollapseButton_Click(object sender, RoutedEventArgs e)
{
            if (this.inputParametersDataGrid.RowDetailsVisibilityMode == Telerik.Windows.Controls.GridView.GridViewRowDetailsVisibilityMode.Visible)
            {
                this.inputParametersDataGrid.RowDetailsVisibilityMode = Telerik.Windows.Controls.GridView.GridViewRowDetailsVisibilityMode.Collapsed;
            }
            else if (this.inputParametersDataGrid.RowDetailsVisibilityMode == Telerik.Windows.Controls.GridView.GridViewRowDetailsVisibilityMode.Collapsed)
            {
                this.inputParametersDataGrid.RowDetailsVisibilityMode = Telerik.Windows.Controls.GridView.GridViewRowDetailsVisibilityMode.Visible;
            }
}
but now  I am using the TreeListView control in Silverlight 3 on VSTS 2008 SP1. How would I achieve the same effect using a expand/collapse button?

1 Answer, 1 is accepted

Sort by
0
JungTae
Top achievements
Rank 1
answered on 16 Nov 2010, 08:32 PM
Nevermind, I figured it out


bool isExpanded = false;
private void expandCollapseButton_Click(object sender, RoutedEventArgs e)
        {
            if (isExpanded == false)
            {
                this.inputParametersTreeListView.ExpandAll();
                isExpanded = true;
            }
            else
            {
                this.inputParametersTreeListView.CollapseAll();
                isExpanded = false;
            }
        }
Tags
TreeListView
Asked by
JungTae
Top achievements
Rank 1
Answers by
JungTae
Top achievements
Rank 1
Share this question
or