Expand and Collapse from code

2 posts, 0 answers
  1. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 16 Nov 2010 Link to this post

    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?
  2. JungTae
    JungTae avatar
    54 posts
    Member since:
    Sep 2010

    Posted 16 Nov 2010 Link to this post

    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;
                }
            }
  3. DevCraft banner
Back to Top