HI,
使用Syncfusions Gridlist控件:
用户应该能够选择各种行(1或多个),然后我需要一种方法来以编程方式确定选择哪些行。 我将在网格上使用上下文菜单,因此我需要找到那时选择的那些。
对上述内容的任何帮助都很棒
答案 0 :(得分:1)
您可以像这样访问所选项目:
foreach (SelectedRecord selectedRecord in Grid.Table.SelectedRecords)
{
TypeBoundToDataGrid typeBound= selectedRecord.Record.GetData() as TypeBoundToDataGrid ;
}
请注意:您需要在网格中打开选择模式:
对于MultiSelection:
Grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
Grid.TableOptions.ListBoxSelectionCurrentCellOptions =
GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell
| GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;
For SingleSelection
Grid.TableOptions.ListBoxSelectionMode = SelectionMode.One;
Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
Grid.TableOptions.ListBoxSelectionCurrentCellOptions =
GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell
| GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;
约什
答案 1 :(得分:0)
检查右键单击网格时触发的网格事件,并查看为您提供的参数(使用“e”)。