Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1470
Swap Columns and Rows (from Codebehind)
posted

Hi

im trying to swap the columns and rows in a pivot grid from code behind. I found the sample, where its done in xaml. I try to reproduce it in code behind like this:

        public void Swap()
        {
            try
            {
                Infragistics.Controls.Grids.PivotGridCommand command = new Infragistics.Controls.Grids.PivotGridCommand();
                command.Execute(this.pivotGrid);
            }
            catch (Exception ex)
            {
                ExceptionCenter.Log(ex);
            }
        }

But the code does not do anything. What im missing?

Regards

  • 1760
    Verified Answer
    posted

    Hi PV85281,

     

    Instead of doing such ugly thing to try to use commanding in code behind, to achieve your goal, you can call "PivotGrid()" method for pivotgrid datasource object. Just write this line of code where necessary:

    this.pivotGrid.DataSource.PivotGrid();

     

    Thanks,

    M.Yovchev