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

Unfreeze row headers

8 Answers 215 Views
PivotGrid and PivotFieldList
This is a migrated thread and some comments may be shown as answers.
Tapakah
Top achievements
Rank 2
Tapakah asked on 04 Nov 2015, 08:21 AM
Hi, plz help: how to unfreeze row headers(scroll all columns)

8 Answers, 1 is accepted

Sort by
0
Hristo
Telerik team
answered on 04 Nov 2015, 02:00 PM
Hello TaPaKaH,

Thank you for writing.

You can achieve this task by handling the ViewRowFormatting event and collapsing the visibility of the pinned container element holding the row headers: 
private void radGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e)
{
    ((GridVirtualizedRowElement)e.RowElement).LeftPinnedColumns.Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
}

I am also attaching a gif file showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tapakah
Top achievements
Rank 2
answered on 04 Nov 2015, 02:13 PM
RadPivotGrid not has ViewRowFormatting
0
Tapakah
Top achievements
Rank 2
answered on 04 Nov 2015, 02:41 PM

for understanding, how work with this scroll bar and frozen columns^)

 

0
Hristo
Telerik team
answered on 05 Nov 2015, 01:56 PM
Hello TaPaKaH,

Thank you for writing back.

Please excuse me for the misunderstanding. Since you are having so many items in the RowHeaderContainer, perhaps the Compact layout is suitable for your project. Please check the following documentation article: Layout Settings.

If any of the predefined layouts is not suitable for your scenario, you can try collapsing the header elements and adjust the position of your pivot cells. Please check my example below: 
public Form1()
{
    InitializeComponent();
 
    this.radPivotGrid1.PivotGridElement.HScrollBar.RadPropertyChanged += HScrollBar_RadPropertyChanged;
}
 
private void HScrollBar_RadPropertyChanged(object sender, RadPropertyChangedEventArgs e)
{
    if (e.Property.Name == "Visibility")
    {
        bool shouldHide = this.radPivotGrid1.PivotGridElement.HScrollBar.Visibility == ElementVisibility.Visible;
        this.ChangeVisibleStateOfHeaders(shouldHide);
        this.AdjustPositionOfMainPivotItems(shouldHide);
    }
}
 
private void AdjustPositionOfMainPivotItems(bool shouldHide)
{
    if (shouldHide)
    {
        this.radPivotGrid1.PivotGridElement.ColumnDescriptorsArea.PositionOffset = new SizeF(-this.radPivotGrid1.PivotGridElement.RowDescriptorsArea.Size.Width, 0);
        this.radPivotGrid1.PivotGridElement.PivotRowsContainer.PositionOffset = new SizeF(-this.radPivotGrid1.PivotGridElement.RowDescriptorsArea.Size.Width, 0);
        this.radPivotGrid1.PivotGridElement.ColumnHeaderContainer.PositionOffset = new SizeF(-this.radPivotGrid1.PivotGridElement.RowDescriptorsArea.Size.Width, 0);
    }
    else
    {
        this.radPivotGrid1.PivotGridElement.ColumnDescriptorsArea.PositionOffset = new SizeF(0, 0);
        this.radPivotGrid1.PivotGridElement.PivotRowsContainer.PositionOffset = new SizeF(0, 0);
        this.radPivotGrid1.PivotGridElement.ColumnHeaderContainer.PositionOffset = new SizeF(0, 0);
    }
     
}
 
private void ChangeVisibleStateOfHeaders(bool shouldHide)
{
    if (shouldHide)
    {
        this.radPivotGrid1.PivotGridElement.AggregateDescriptorsArea.Visibility = ElementVisibility.Collapsed;
        this.radPivotGrid1.PivotGridElement.RowDescriptorsArea.Visibility = ElementVisibility.Collapsed;
        this.radPivotGrid1.PivotGridElement.RowHeaderContainer.Visibility = ElementVisibility.Collapsed;
    }
    else
    {
        this.radPivotGrid1.PivotGridElement.AggregateDescriptorsArea.Visibility = ElementVisibility.Visible;
        this.radPivotGrid1.PivotGridElement.RowDescriptorsArea.Visibility = ElementVisibility.Visible;
        this.radPivotGrid1.PivotGridElement.RowHeaderContainer.Visibility = ElementVisibility.Visible;
    }
}

I am also sending you a gif file showing the result on my end.

I hope this helps. Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tapakah
Top achievements
Rank 2
answered on 06 Nov 2015, 06:51 AM
Thanks, but this solution looks bad. I would propose to use the change Layout Settings. Tell me, is it possible to specify the width for each RowHeader?
0
Hristo
Telerik team
answered on 06 Nov 2015, 12:35 PM
Hello TaPaKaH,

Thank you for writing back.

You can resize the width of a particular header by calling the SetRowHeaderWidth method on the RadPivotGridElement. You would need to pass as parameter the level of the header, please check below:
//First row header will 50pixel
this.radPivotGrid1.PivotGridElement.SetRowHeaderWidth(50, 0);

I hope this helps. Should you have further questions please do not hesitate to write back. 

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Tapakah
Top achievements
Rank 2
answered on 06 Nov 2015, 12:39 PM
Thanks for the quick and useful help
0
Hristo
Telerik team
answered on 10 Nov 2015, 07:59 AM
Hello TaPaKaH,

I am glad that I managed to help.

Should you have further questions please do not hesitate to write back.

Regards,
Hristo Merdjanov
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
PivotGrid and PivotFieldList
Asked by
Tapakah
Top achievements
Rank 2
Answers by
Hristo
Telerik team
Tapakah
Top achievements
Rank 2
Share this question
or