代码之家  ›  专栏  ›  技术社区  ›  Brando

同步网格列表控制

  •  0
  • Brando  · 技术社区  · 17 年前

    你好

    使用Syncfusions Gridlist控件:

    用户应该能够选择不同的行(1行或多行),然后我需要一种方法以编程方式确定选择了哪些行。 我将使用网格上的上下文菜单,所以我需要找到在那个点上选择了哪些。

    以上方面的任何帮助都会很好

    2 回复  |  直到 17 年前
        1
  •  1
  •   jj.matthews    17 年前

    您可以通过以下方式访问所选项目:

     foreach (SelectedRecord selectedRecord in Grid.Table.SelectedRecords)
                    {
                        TypeBoundToDataGrid typeBound= selectedRecord.Record.GetData() as TypeBoundToDataGrid ;
    
                    }
    

    请注意:您需要通过以下操作打开网格中的选择模式:

    选举:

    Grid.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended;
            Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
            Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
            Grid.TableOptions.ListBoxSelectionCurrentCellOptions = 
                GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell 
                | GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;
    

    单选

    Grid.TableOptions.ListBoxSelectionMode = SelectionMode.One;
            Grid.TableOptions.AllowSelection = GridSelectionFlags.None;
            Grid.TableOptions.ListBoxSelectionColorOptions = GridListBoxSelectionColorOptions.ApplySelectionColor;
            Grid.TableOptions.ListBoxSelectionCurrentCellOptions = 
                GridListBoxSelectionCurrentCellOptions.WhiteCurrentCell 
                | GridListBoxSelectionCurrentCellOptions.MoveCurrentCellWithMouse;
    

    乔希

        2
  •  0
  •   Daryl    17 年前

    检查右键单击网格时触发的网格事件,并查看为您提供的参数(使用“e”)。