Unfreeze row headers

9 posts, 0 answers
  1. TaPaKaH
    TaPaKaH avatar
    11 posts
    Member since:
    Apr 2014

    Posted 04 Nov 2015 Link to this post

    Hi, plz help: how to unfreeze row headers(scroll all columns)
  2. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 04 Nov 2015 Link to this post

    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
  3. UI for WinForms is Visual Studio 2017 Ready
  4. TaPaKaH
    TaPaKaH avatar
    11 posts
    Member since:
    Apr 2014

    Posted 04 Nov 2015 in reply to Hristo Link to this post

    RadPivotGrid not has ViewRowFormatting
  5. TaPaKaH
    TaPaKaH avatar
    11 posts
    Member since:
    Apr 2014

    Posted 04 Nov 2015 Link to this post

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

     

  6. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 05 Nov 2015 Link to this post

    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
  7. TaPaKaH
    TaPaKaH avatar
    11 posts
    Member since:
    Apr 2014

    Posted 06 Nov 2015 in reply to Hristo Link to this post

    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?
  8. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 06 Nov 2015 Link to this post

    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
  9. TaPaKaH
    TaPaKaH avatar
    11 posts
    Member since:
    Apr 2014

    Posted 06 Nov 2015 in reply to Hristo Link to this post

    Thanks for the quick and useful help
  10. Hristo
    Admin
    Hristo avatar
    716 posts

    Posted 10 Nov 2015 Link to this post

    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
Back to Top
UI for WinForms is Visual Studio 2017 Ready