Exemplo n.º 1
0
        public void SetSelectedCell(DataGridCell Cell)
        {
            if (Cell == null || Cell.IsEditing || Cell.IsReadOnly)
            {
                return;
            }

            if (!Cell.IsFocused)
            {
                Cell.Focus();
            }

            if (this.EditingDataGrid.SelectionUnit != DataGridSelectionUnit.FullRow)
            {
                if (!Cell.IsSelected)
                {
                    Cell.IsSelected = true;
                }
            }
            else
            {
                var row = Cell.GetNearestVisualDominantOfType <DataGridRow>();
                if (row != null && !row.IsSelected)
                {
                    row.IsSelected = true;
                }
            }
        }