Hi
In my pivotgrid I have the following hierarchies :
On Columns - Geographies (e.g. World, Regions, Countries )On Rows - Items (e.g. Item Level 1, Item Level 2, Item Level 3)
and a single measure (Percentage Improvement) which has a custom aggregator which works out the weighted average improvement.
So the geographies hierarchy could contain:
World Europe UK Ireland France
and the items hierarchy:
Items Group 1 Items Group 2 Item 1 Item 2
I have implemented cell editing which is working but when I try to fine-tune it, I begin to get a little stuck so am hoping you'll be able to give me some direction.
1. In the example above, let's say that Item 1 can only have an improvement entered against the region level and so we need to disable direct user editing for UK, Ireland & France for Item 1. I have trapped the CellEnterEdit event but can't see anyway of cancelling the edit (or disallowing it). Is there a way?
2. Assuming the user has entered 10% against Europe for Item 1, I pass this value down to each of the child countries to keep the aggregator working but I don't want to display the value at country level for this item. Is this possible?
Thanks
Keith
HI,
As far as canceling editing of a cell, you could wire up the CelEditing Event and cancel it.
Here a link on CellEditing Event.http://help.infragistics.com/NetAdvantage/WPF/2012.1/CLR4.0/?page=InfragisticsWPF4.Controls.Grids.XamPivotGrid.v12.1~Infragistics.Controls.Grids.XamPivotGrid~CellEditing_EV.html
Sincerely,
Matt Developer Support Engineer
Hello Matt.
As far as I can see, CellEditing event is fired when cell is exiting editing, but the author was talking about CellEnterEdit event.
So, this is completely different cases: to cancel start of editing or to cancel editing.
I have an urgent requirement to restrict editing for certain cells too. How can I archieve this? All that I have came up with is to replace CustomEditor with Label in CellEnterEdit event, but the cell still enters edit mode, which cancels keyboard navigation.
P.S. It's so strange than this control doesn't have such trivial functionality as conditional read-only cells or double-click editing :(
Hello,
Thank you for your post. I have been looking into it and I created a sample project with the functionality you want. Basically I handled the XamPivotGrid's CellControlAttached event and in the handler I handle the CellControl's PreviewMouseLeftButtonDown event. In its handler you are able to get the current Cell and handle the event if a condition is met, which won't put the cell in edit mode. You can also suggest a product idea for adding "CellEnteringEditMode event" here:
http://ideas.infragistics.com/
Stefan,
Unfortunately, I can't select any cells now. And worse, CellDoubleClicked is not firing now, and who knows what else can be wrong with this workaround.
How can I overcome this?
Instead of handling the PreviewMouseLeftButtonDown event, you can set the XamPivotGrid's EditSettings' AllowCellEdit Property to true and false based on the cell you click. Please let me know if this helps you or you need further assistance on this matter.
Looking forward for your reply.
Thanks you Stefan!
But you didn't answer on my another question: is there any other ways to enter edit mode besides mouse click and enter button? I need to restrict all ways to enter edit mode.
UPD. Stefan, in your attached example CellControl attached event fires multiple time for the same cell, which leads to multiple execution of PreviewLeftMouseButtonDown handler. This is a problem, what can I do about ut?
Currently the only ways to enter edit mode are by clicking the cell or hit "Enter". As for the multiple firing of the CellControlAttached event, you can use the Tag Property of the CellControl and check if you handled the PreviewLeftMouseButtonDown event for this cell or not. You can use the following code in the CellControlAttached event handler:
if (e.Cell.Control.Tag == null) { e.Cell.Control.Tag = "handled"; e.Cell.Control.PreviewMouseLeftButtonDown += Control_PreviewMouseLeftButtonDown; }
Please let me know if you have further questions on this matter.