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
Select / Activate XamPivotGrid cell from code-behind after loading.

I'm looking to Select / Activate a cell in an Ultimate UI for WPF XamPivotGrid v.16.2 from code-behind just like you could if you clicked on a cell using a mouse.  I’m loading the pivot grid using a FlatDataSource and want to set the first data cell as the active cell.  I have seen a lot of examples to do this using the standard grid control but not for a Pivot Grid. Any Examples out there to do this?

No Data
  • 28910
    Verified Answer
    Offline posted

    Hello Peter,

    In order to select a XamPivotGrid cell, you can go through the XamPivotGrid's GridLayout. You can use the following code in order to select and activate the first cell in the XamPivotGrid:

    PivotCell cell = pivot.GridLayout.Rows[0].Cells[0];
    pivot.ActiveCell = cell;

    Note, if you are looking to do this in a Loaded event or something like that, you may want to delay the operation from happening until the grid cells have actually loaded. The ResultChanged event of the FlatDataSource can help with this, or utilizing a Dispatcher.BeginInvoke action may help as well.

    I have attached a sample project to demonstrate the above.

    I hope this helps. Please let me know if you have any other questions or concerns on this matter.

    Associate Developer
No Data