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
1060
Set active cell on right mouse click
posted

Hello

I'm using xamwebgrid 9.2.20092.2014.

I have successfully implemented a xamContextMenu on a right mouse click and now I want to set the active cell of the grid to the one under the mouse pointer on the right mouse button click.

I'm trying to use the grids MouseRightButtonDown event but i just get this when i build the project :

Error 569 The property 'MouseRightButtonDown' does not exist on the type 'XamWebGrid' in the XML namespace 'clr-namespace:Infragistics.Silverlight.Controls;assembly=Infragistics.Silverlight.XamWebGrid.v9.2'.

Any ideas?  Is there another way to achieve this?
Thanks
Kevin

  • 5595
    Verified Answer
    posted

    Hi,

    You could achieve this scenario by using the XamWebContextMenu.Opening event:

           

            private void XamWebContextMenu_Opening(object sender, OpeningEventArgs e)

            {

                CellBase cell = null;

                Row row = null;

                List<CellControl> cells = e.GetClickedElements<CellControl>();

     

                if (cells.Count == 0)

                {

                    return;

                }

     

                cell = cells.First().Cell;

                row = cell.Row as Row;

     

                if (row.RowType != RowType.DataRow)

                {

                    return;

                }

     

                cell.IsActive = true;

            }

     

    Note the e.GetClickedElements() method.

     

    HTH,