/// <summary>
 ///     Instantiates a new instance of this class.
 /// </summary>
 /// <param name="column">The column of the cell that is about to exit edit mode.</param>
 /// <param name="row">The row container of the cell container that is about to exit edit mode.</param>
 /// <param name="editingElement">The editing element within the cell.</param>
 /// <param name="editingUnit">The editing unit that is about to leave edit mode.</param>
 public DataGridCellEditEndingEventArgs(DataGridColumn column, DataGridRow row, FrameworkElement editingElement, DataGridEditAction editAction)
 {
     _dataGridColumn = column;
     _dataGridRow = row;
     _editingElement = editingElement;
     _editAction = editAction;
 }
 /// <summary>
 ///     Constructs a new instance of these event arguments.
 /// </summary>
 /// <param name="column">The column of the cell that just entered edit mode.</param>
 /// <param name="row">The row container that contains the cell container that just entered edit mode.</param>
 /// <param name="editingEventArgs">The event arguments, if any, that led to the cell being placed in edit mode.</param>
 /// <param name="cell">The cell container that just entered edit mode.</param>
 /// <param name="editingElement">The editing element within the cell container.</param>
 public DataGridPreparingCellForEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs, FrameworkElement editingElement)
 {
     _dataGridColumn = column;
     _dataGridRow = row;
     _editingEventArgs = editingEventArgs;
     _editingElement = editingElement;
 }
        private void UpdateGridLayout()
        {
            //
            Microsoft.Windows.Controls.DataGridCell cell;
            for (int i = 0; i < Int32.Parse(lblRecordCount.Content.ToString()); i++)
            {
                Microsoft.Windows.Controls.DataGridRow row = (Microsoft.Windows.Controls.DataGridRow)dgPaintProduct.ItemContainerGenerator.ContainerFromIndex(i);
                if (row != null)
                {
                    DataRowView item = row.Item as DataRowView;
                    if (item != null)
                    {
                        switch (Int32.Parse(item["OPStatus"].ToString()))
                        {
                        case 1:
                            cell            = GetCell(row, 5);
                            cell.Background = Brushes.Red;
                            break;

                        case 2:
                            cell            = GetCell(row, 5);
                            cell.Background = Brushes.Yellow;
                            break;

                        case 3:
                            cell            = GetCell(row, 5);
                            cell.Background = Brushes.HotPink;
                            break;

                        case 4:
                            cell            = GetCell(row, 5);
                            cell.Background = Brushes.Orange;
                            //button_cell = GetCell(row, 0);
                            //var cp = button_cell.Content as ContentPresenter;
                            //var button = cp.ContentTemplate.FindName("btnStart", cp) as Button;
                            //button.IsEnabled = false;
                            break;

                        case 5:
                            cell            = GetCell(row, 5);
                            cell.Background = Brushes.Green;
                            break;

                        case 6:
                            cell            = GetCell(row, 5);
                            cell.Background = Brushes.Gray;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
Beispiel #4
0
        private void UpdateGridLayout()
        {
            //
            Microsoft.Windows.Controls.DataGridCell cell;
            for (int i = 0; i < Int32.Parse(lblRecordCount.Content.ToString()); i++)
            {
                Microsoft.Windows.Controls.DataGridRow row = (Microsoft.Windows.Controls.DataGridRow)dgOrders.ItemContainerGenerator.ContainerFromIndex(i);
                if (row != null)
                {
                    DataRowView item = row.Item as DataRowView;
                    if (item != null)
                    {
                        switch (Int32.Parse(item["OrderStatus"].ToString()))
                        {
                        case 1:
                            cell            = GetCell(row, 4);
                            cell.Background = Brushes.Red;
                            break;

                        case 2:
                            cell            = GetCell(row, 4);
                            cell.Background = Brushes.Yellow;
                            break;

                        case 3:
                            cell            = GetCell(row, 4);
                            cell.Background = Brushes.HotPink;
                            break;

                        case 4:
                            cell            = GetCell(row, 4);
                            cell.Background = Brushes.Orange;
                            break;

                        case 5:
                            cell            = GetCell(row, 4);
                            cell.Background = Brushes.Green;
                            break;

                        case 6:
                            cell            = GetCell(row, 4);
                            cell.Background = Brushes.Gray;
                            break;

                        default:
                            break;
                        }
                    }
                }
            }
        }
 public DataGridRowEventArgs(DataGridRow row)
 {
     Row = row;
 }
 /// <summary>
 ///     Prepares a cell for use.
 /// </summary>
 /// <remarks>
 ///     Updates the column reference.
 ///     This overload computes the column index from the ItemContainerGenerator.
 /// </remarks>
 internal void PrepareCell(object item, ItemsControl cellsPresenter, DataGridRow ownerRow)
 {
     PrepareCell(item, ownerRow, cellsPresenter.ItemContainerGenerator.IndexFromContainer(this));
 }
 /// <summary>
 ///     Clears the cell of references.
 /// </summary>
 internal void ClearCell(DataGridRow ownerRow)
 {
     Debug.Assert(_owner == ownerRow, "_owner should be the same as the DataGridRow that is clearing the cell.");
     _owner = null;
 }
        public static Microsoft.Windows.Controls.DataGridCell GetCell(this Microsoft.Windows.Controls.DataGrid grid, Microsoft.Windows.Controls.DataGridRow row, int column)
        {
            if (row != null)
            {
                DataGridCellsPresenter presenter = GetVisualChild <DataGridCellsPresenter>(row);

                if (presenter == null)
                {
                    grid.ScrollIntoView(row, grid.Columns[column]);
                    presenter = GetVisualChild <DataGridCellsPresenter>(row);
                }

                Microsoft.Windows.Controls.DataGridCell cell = (Microsoft.Windows.Controls.DataGridCell)presenter.ItemContainerGenerator.ContainerFromIndex(column);
                return(cell);
            }
            return(null);
        }
 public Microsoft.Windows.Controls.DataGridCell GetCell(Microsoft.Windows.Controls.DataGridRow rowContainer, int column)
 {
     return(HelperPaint.GetCell(dgSoldProduct, rowContainer, column));
 }
Beispiel #10
0
 public DataGridRowEventArgs(DataGridRow row)
 {
     Row = row;
 }
 /// <summary>
 ///     Instantiates a new instance of this class.
 /// </summary>
 /// <param name="row">The row container of the cell container that is about to exit edit mode.</param>
 /// <param name="editingUnit">The editing unit that is about to leave edit mode.</param>
 public DataGridRowEditEndingEventArgs(DataGridRow row, DataGridEditAction editAction)
 {
     _dataGridRow = row;
     _editAction  = editAction;
 }
 public DataGridRowDetailsEventArgs(DataGridRow row, FrameworkElement detailsElement)
 {
     Row = row;
     DetailsElement = detailsElement;
 }
 /// <summary>
 ///     Instantiates a new instance of this class.
 /// </summary>
 /// <param name="column">The column of the cell that is about to enter edit mode.</param>
 /// <param name="row">The row container of the cell container that is about to enter edit mode.</param>
 /// <param name="editingEventArgs">The event arguments, if any, that led to the cell entering edit mode.</param>
 public DataGridBeginningEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs)
 {
     _dataGridColumn   = column;
     _dataGridRow      = row;
     _editingEventArgs = editingEventArgs;
 }
Beispiel #14
0
 public Microsoft.Windows.Controls.DataGridCell GetCell(Microsoft.Windows.Controls.DataGridRow rowContainer, int column)
 {
     return(Helper.GetCell(dgOrders, rowContainer, column));
 }
 /// <summary>
 ///     Instantiates a new instance of this class.
 /// </summary>
 /// <param name="row">The row container of the cell container that is about to exit edit mode.</param>
 /// <param name="editingUnit">The editing unit that is about to leave edit mode.</param>
 public DataGridRowEditEndingEventArgs(DataGridRow row, DataGridEditAction editAction)
 {
     _dataGridRow = row;
     _editAction = editAction;
 }
 public DataGridRowDetailsEventArgs(DataGridRow row, FrameworkElement detailsElement)
 {
     Row            = row;
     DetailsElement = detailsElement;
 }