Hi James,
1. I have a grid in which I want to be able to multi-select rows.
>>>>>>>>>>
In the GridGroupingControl, there are couple of Slection mechanisms. If you want to select rows, please use the RecordBased slections.
You need to turn off the AllowSelection to None and set the Grid.TableOptions.ListBoxSelection Mode to MultiExtanded/MultiSimple.
Please refer this shipping sample:
\windows\Grid.Grouping.Windows\Samples\GroupingGridOptions\TableOptions\
\windows\Grid.Grouping.Windows\Samples\FeatureSamples\MultipleRecordSelection
Also refer to the following knowledge base article for more details.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=3442. I want to maintain my selection when I do a right-click on the ggc so that I can take some actions on the the selected records.
>>>>>>>>>>
Try setting the SelectCellsMouseButtonsMask property to MouseButtons.Left;
this.gridGroupingControl1.TableControl.Model.Options.SelectCellsMouseButtonsMask = MouseButtons.Left;
3. I also want to maintain my selection unless a certain column index are clicked. For example, if I have 5 columns, only the last two columns should toggle my selection.
>>>>>>>>>>
This is can be achieved by handling the SelectedRecordsChanging event of the grid and set e.Cancel to true for required column. Here is a code snippet to show this.
private void gridGroupingControl1_SelectedRecordsChanging(object sender, SelectedRecordsChangedEventArgs e)
{
string tName = e.Table.TableDescriptor.Name;
GridGroupingControl grid = sender as GridGroupingControl;
GridTableControl tc = grid.GetTableControl(tName);
int row,col;
if( tc.PointToRowCol(grid.PointToClient(MousePosition),out row,out col)
&& col == 4)
e.Cancel = true;
}
4. Showing the contextMenu in a Grid.
>>>>>>>>>
You can handle the TableControlmouseDown event of the grid and show the context menu for the GridRecord. Here is a code snippet
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
if(e.Inner.Button == MouseButtons.Right )
{
int row, col;
Point pt = new Point(e.Inner.X, e.Inner.Y);
if (e.TableControl.PointToRowCol(pt, out row, out col))
e.TableControl.CurrentCell.AdjustRowColIfCoveredCell(ref row, ref col);
GridTableCellStyleInfo tableCellStyle = e.TableControl.GetTableViewStyleInfo(row, col);
Element contextElement = tableCellStyle.TableCellIdentity.DisplayElement;
this.contextMenu1.MenuItems.Clear();
if (contextElement is GridRecordRow)
{
this.contextMenu1.MenuItems.Add("Combine");
this.contextMenu1.Show(this, this.PointToClient(Control.MousePosition));
}
}
}
Please refer to the attached sample for more details.
GGC_Group_91041887.zipBest regards,
Haneef