예제 #1
0
        public static void AutoEditOnDigit(DataGrid2 grid, string name)
        {
            var column = DataGridHelper.FindColumn(grid.Columns, name);

            grid.TextInput += (sender, args) => {
                if (grid.SelectedItem == null)
                {
                    return;
                }
                var isDigit = args.Text.All(Char.IsDigit);
                if (!isDigit)
                {
                    return;
                }
                args.Handled     = true;
                grid.CurrentCell = new DataGridCellInfo(grid.SelectedItem, column);
                grid.BeginEdit(args);
            };
        }