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?
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.Cells;pivot.ActiveCell = cell;pivot.SelectionSettings.SelectedCells.Add(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.