WPF Datagrid cell, cellinfo and selectedcells + custom selection

前端 未结 1 693
半阙折子戏
半阙折子戏 2020-12-19 10:26

I want to manipulate selection in WPF datagrid, but I have problem with access to actual cells and setting focus on them and marking them as selected.

  1. Ca
1条回答
  •  隐瞒了意图╮
    2020-12-19 11:22

    Answer to question 1: A quick way to get DataGridCell from DataGridCellInfo:

        public DataGridCell GetDataGridCell(DataGridCellInfo cellInfo)
        {
            var cellContent = cellInfo.Column.GetCellContent(cellInfo.Item);
            if (cellContent != null)
                return (DataGridCell) cellContent.Parent;
    
            return null;
        }
    

    0 讨论(0)
提交回复
热议问题