Expand some ColumnGroupHeaders

2 posts, 0 answers
  1. Jaakko
    Jaakko avatar
    1 posts
    Member since:
    Oct 2013

    Posted 27 Jun 2014 Link to this post

    Hi,

    I have a question about expanding some of the ColumnGroupHeaders. I am aware that it is possible to set the default expansion, but I need most of them collapsed whilst having a few expanded. 

    I tried overriding the style(I use a StyleSelector) to no avail. There is a property for 'IsExpanded' but it did nothing. I also tried from code-behind and managed to alter the expanded state, but unfortunately the content of the expander was not loaded.

    Any help would be appreciated whether via XAML or code-behind.

    Best Regards,
    -Jaakko
  2. Rosen Vladimirov
    Admin
    Rosen Vladimirov avatar
    640 posts

    Posted 30 Jun 2014 Link to this post

    Hi Jaako,

    RadPivotGrid has CollapseColumn and ExpandColumn methods that you can use in order to achieve the desired functionality. You can set ColumnGroupsExpandBehavior to collapse all columns and on Loaded of RadPivotGrid you can expand only the ones you want, for example:
    void radPivotGrid_Loaded(object sender, RoutedEventArgs e)
    {
        Dispatcher.BeginInvoke(new Action(() =>
        {
            var groups = this.radPivotGrid.ColumnGroups.Where(r => r.Name.ToString() == "Copy holder");
            foreach (IGroup gr in groups)
            {
                this.radPivotGrid.ExpandColumn(gr);
     
            }
        }));
    }

    Please note that RadPivotGrid's ColumnGroups collection holds only the top level Groups. In case you want to expand one of the children of a particular column, you should expand the parent first and in the IGroup you will find Groups collection which holds all children. You can find the group which you want to expand and call this.radPivotGrid.ExpandColumn for this group.

    Hope this helps.

    Regards,
    Rosen Vladimirov
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. DevCraft banner
Back to Top