1

WPF データグリッドで表示されている列のみの数を取得するにはどうすればよいですか? カウントを使用して、データグリッドに存在する列をナビゲートしています。

 if (getSelectedRow().IsEditing)
                    {
                        if (dataGrid.SelectedCells.Count != 0)
                        {
                            int columnDisplayIndex = dataGrid.CurrentCell.Column.DisplayIndex + 1;

                            if (columnDisplayIndex <= dataGrid.Columns.Count)
                            {
                                if (columnDisplayIndex == dataGrid.Columns.Count)

                                {
                                    row.MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

                                    nextColumn = dataGrid.ColumnFromDisplayIndex(nextCol(1) - 1);
                                    dataGrid.CurrentCell = new DataGridCellInfo(dataGrid.SelectedItem, nextColumn);

                                }
                                else
                                {
                                    e.Handled = true;
                                    nextColumn = dataGrid.ColumnFromDisplayIndex(nextCol(columnDisplayIndex));
                                    dataGrid.CurrentCell = new DataGridCellInfo(dataGrid.SelectedItem, nextColumn);
                                }

                            }
                        }

                        if (isNotComboBox())
                        {
                            dataGrid.CommitEdit();
                        }

                    }
4

0 に答える 0