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

Expand some ColumnGroupHeaders

1 Answer 16 Views
PivotGrid
This is a migrated thread and some comments may be shown as answers.
Jaakko
Top achievements
Rank 1
Jaakko asked on 27 Jun 2014, 01:45 PM
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

1 Answer, 1 is accepted

Sort by
0
Rosen Vladimirov
Telerik team
answered on 30 Jun 2014, 09:55 AM
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.
 
Tags
PivotGrid
Asked by
Jaakko
Top achievements
Rank 1
Answers by
Rosen Vladimirov
Telerik team
Share this question
or