Hello,
Is there a sample to show integration of xamcontextMenu with xamgrid?
I would like to provide some operations in a context menu on a grid depending on the cell / column header that has been right clicked.
Please ask me if you need more explanations.
Regards,
Hello Julien,
I have been looking into your request and even though there are no such samples available, I have found a way for you to achieve your goal. You can use the XamContextMenu’s Open and Opening events to get the element you need . In your case I can suggest finding the CellControl since it would provide you with the information you mentioned. You can do it by using this code snippet in the either of the events:
if (e.GetClickedElements<CellControl>().Count >0)
{
CellControl temp = e.GetClickedElements<CellControl>()[0];
}
Please let me know if you require any further assistance on the matter.
Sincerely,
Petar Monov
Developer Support Engineer
Infragistics Bulgaria
www.infragistics.com/support
Hello Petar,
Yes you are right : CellControl has a property Cell and Column, so that's exactly what I need. This is working like a charm to handle right click on a normal cell or column header.
However I need a bit more help for the case of a grid with a group by :
When I right click on a group header or a group line, the column object I get is not the one I need.
Infragistics.Controls.Grids.Primitives.CellControlBase clickedCellControl = e.GetClickedElements<Infragistics.Controls.Grids.Primitives.CellControlBase>().FirstOrDefault();Column column = clickedCellControl.Column;
clickedCellControl is either of class GroupByHeaderCellControl or GroupByCellControl.
In both case, column.Key is null : I suppose I have somthing more to do to get the real column object (and its key)
Do you have some suggestions to get the real column object on a click on a group header or group row?
Thanks for yor help.
Regards,Julien
I have been looking into your request and have found a way for you to get this. Here is a code snippet you can use in the same event:
if (e.GetClickedElements<GroupByCellControl>().Count > 0)
GroupByCellControl groupByCellControl = e.GetClickedElements<GroupByCellControl>()[0];
if (groupByCellControl.Cell != null && groupByCellControl.Cell.Row != null)
var column = ((RowsManager)groupByCellControl.Cell.Row.Manager).GroupedColumn;
Please let me know if I can assist you further on the matter.
Thank you very very much! This works like a charm. :)
I used your sample and the same code with GroupByHeaderCellControl for group by headers in group by area.
Regards,Julien Benoit