Column and row label formatting/Sizing

2 posts, 0 answers
  1. Mark
    Mark avatar
    132 posts
    Member since:
    Oct 2014

    Posted 06 Oct 2015 Link to this post

    1. I am using Linq as my data source

    2. I am programmatically creating the pivot data (PropertyGroupDescription)

    3. I need a way to tell the differences between the ROW LABELS and the COLUMN LABELS in the GroupElementFormatting event so I can resize my ROW LABEL so I can see all the text and Right Align the test in my COLUMN LABELS.  From what I can tell, they are all the same OBJECT TYPE and I can't rely on looking at the TEXT/DESCRIPTION as this data is dynamic.





  2. Hristo
    Hristo avatar
    1522 posts

    Posted 08 Oct 2015 Link to this post

    Hi Mark,

    Thank you for writing.

    In order to resize the row headers according to their content, you would need to iterate them and call the BestFitRowHeaders method for each of them: 
    private void BestFitHeaders()
        for (int i = 0; i < this.radPivotGrid1.PivotGridElement.RowDescriptorsArea.Children.Count; i++)

    Considering the RightToLeft column labels, you can still handle the GroupElementFormatting event, check for the Axis type of the Data object and if the value is Columns set the RightToLeft property to true
    private void radPivotGrid1_GroupElementFormatting(object sender, PivotGroupElementEventArgs e)
        if (e.GroupElement.Data.Axis == PivotAxis.Columns)
            e.GroupElement.RightToLeft = true;

    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.

    Hristo Merdjanov
    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