// (c) Copyright Microsoft Corporation. // This source is subject to the Microsoft Public License (Ms-PL). // Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details. // All other rights reserved. using Avalonia.Input; using Avalonia.Interactivity; using System; using System.ComponentModel; using System.Diagnostics; namespace Avalonia.Controls { /// /// Provides data for the event. /// public class DataGridAutoGeneratingColumnEventArgs : CancelEventArgs { /// /// Initializes a new instance of the class. /// /// /// The name of the property bound to the generated column. /// /// /// The of the property bound to the generated column. /// /// /// The generated column. /// public DataGridAutoGeneratingColumnEventArgs(string propertyName, Type propertyType, DataGridColumn column) { Column = column; PropertyName = propertyName; PropertyType = propertyType; } /// /// Gets the generated column. /// public DataGridColumn Column { get; set; } /// /// Gets the name of the property bound to the generated column. /// public string PropertyName { get; private set; } /// /// Gets the of the property bound to the generated column. /// public Type PropertyType { get; private set; } } /// /// Provides data for the event. /// public class DataGridBeginningEditEventArgs : CancelEventArgs { /// /// Initializes a new instance of the /// class. /// /// /// The column that contains the cell to be edited. /// /// /// The row that contains the cell to be edited. /// /// /// Information about the user gesture that caused the cell to enter edit mode. /// public DataGridBeginningEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs) { this.Column = column; this.Row = row; this.EditingEventArgs = editingEventArgs; } /// /// Gets the column that contains the cell to be edited. /// public DataGridColumn Column { get; private set; } /// /// Gets information about the user gesture that caused the cell to enter edit mode. /// public RoutedEventArgs EditingEventArgs { get; private set; } /// /// Gets the row that contains the cell to be edited. /// public DataGridRow Row { get; private set; } } /// /// Provides information just after a cell has exited editing mode. /// public class DataGridCellEditEndedEventArgs : EventArgs { /// /// Instantiates a new instance of this class. /// /// The column of the cell that has just exited edit mode. /// The row container of the cell container that has just exited edit mode. /// The editing action that has been taken. public DataGridCellEditEndedEventArgs(DataGridColumn column, DataGridRow row, DataGridEditAction editAction) { Column = column; Row = row; EditAction = editAction; } /// /// The column of the cell that has just exited edit mode. /// public DataGridColumn Column { get; private set; } /// /// The edit action taken when leaving edit mode. /// public DataGridEditAction EditAction { get; private set; } /// /// The row container of the cell container that has just exited edit mode. /// public DataGridRow Row { get; private set; } } /// /// Provides information after the cell has been pressed. /// public class DataGridCellPointerPressedEventArgs : EventArgs { /// /// Instantiates a new instance of this class. /// /// The cell that has been pressed. /// The row container of the cell that has been pressed. /// The column of the cell that has been pressed. /// The pointer action that has been taken. public DataGridCellPointerPressedEventArgs(DataGridCell cell, DataGridRow row, DataGridColumn column, PointerPressedEventArgs e) { Cell = cell; Row = row; Column = column; PointerPressedEventArgs = e; } /// /// The cell that has been pressed. /// public DataGridCell Cell { get; } /// /// The row container of the cell that has been pressed. /// public DataGridRow Row { get; } /// /// The column of the cell that has been pressed. /// public DataGridColumn Column { get; } /// /// The pointer action that has been taken. /// public PointerPressedEventArgs PointerPressedEventArgs { get; } } /// /// Provides information just before a cell exits editing mode. /// public class DataGridCellEditEndingEventArgs : CancelEventArgs { /// /// Instantiates a new instance of this class. /// /// The column of the cell that is about to exit edit mode. /// The row container of the cell container that is about to exit edit mode. /// The editing element within the cell. /// The editing action that will be taken. public DataGridCellEditEndingEventArgs(DataGridColumn column, DataGridRow row, Control editingElement, DataGridEditAction editAction) { Column = column; Row = row; EditingElement = editingElement; EditAction = editAction; } /// /// The column of the cell that is about to exit edit mode. /// public DataGridColumn Column { get; private set; } /// /// The edit action to take when leaving edit mode. /// public DataGridEditAction EditAction { get; private set; } /// /// The editing element within the cell. /// public Control EditingElement { get; private set; } /// /// The row container of the cell container that is about to exit edit mode. /// public DataGridRow Row { get; private set; } } internal class DataGridCellEventArgs : EventArgs { internal DataGridCellEventArgs(DataGridCell dataGridCell) { Debug.Assert(dataGridCell != null); this.Cell = dataGridCell; } internal DataGridCell Cell { get; private set; } } /// /// Provides data for column-related events. /// public class DataGridColumnEventArgs : EventArgs { /// /// Initializes a new instance of the class. /// /// The column that the event occurs for. public DataGridColumnEventArgs(DataGridColumn column) { Column = column ?? throw new ArgumentNullException(nameof(column)); } /// /// Gets the column that the event occurs for. /// public DataGridColumn Column { get; private set; } } /// /// Provides data for the event. /// public class DataGridColumnReorderingEventArgs : CancelEventArgs { /// /// Initializes a new instance of the class. /// /// public DataGridColumnReorderingEventArgs(DataGridColumn dataGridColumn) { this.Column = dataGridColumn; } /// /// The column being moved. /// public DataGridColumn Column { get; private set; } /// /// The popup indicator displayed while dragging. If null and Handled = true, then do not display a tooltip. /// public Control DragIndicator { get; set; } /// /// UIElement to display at the insertion position. If null and Handled = true, then do not display an insertion indicator. /// public IControl DropLocationIndicator { get; set; } } /// /// Provides data for row-related events. /// public class DataGridRowEventArgs : EventArgs { /// /// Initializes a new instance of the class. /// /// The row that the event occurs for. public DataGridRowEventArgs(DataGridRow dataGridRow) { this.Row = dataGridRow; } /// /// Gets the row that the event occurs for. /// public DataGridRow Row { get; private set; } } /// /// Provides information just before a row exits editing mode. /// public class DataGridRowEditEndingEventArgs : CancelEventArgs { /// /// Instantiates a new instance of this class. /// /// The row container of the cell container that is about to exit edit mode. /// The editing action that will be taken. public DataGridRowEditEndingEventArgs(DataGridRow row, DataGridEditAction editAction) { this.Row = row; this.EditAction = editAction; } /// /// The editing action that will be taken. /// public DataGridEditAction EditAction { get; private set; } /// /// The row container of the cell container that is about to exit edit mode. /// public DataGridRow Row { get; private set; } } /// /// Provides information just after a row has exited edit mode. /// public class DataGridRowEditEndedEventArgs : EventArgs { /// /// Instantiates a new instance of this class. /// /// The row container of the cell container that has just exited edit mode. /// The editing action that has been taken. public DataGridRowEditEndedEventArgs(DataGridRow row, DataGridEditAction editAction) { this.Row = row; this.EditAction = editAction; } /// /// The editing action that has been taken. /// public DataGridEditAction EditAction { get; private set; } /// /// The row container of the cell container that has just exited edit mode. /// public DataGridRow Row { get; private set; } } /// /// Provides data for the event. /// public class DataGridPreparingCellForEditEventArgs : EventArgs { /// /// Initializes a new instance of the class. /// /// The column that contains the cell to be edited. /// The row that contains the cell to be edited. /// Information about the user gesture that caused the cell to enter edit mode. /// The element that the column displays for a cell in editing mode. public DataGridPreparingCellForEditEventArgs(DataGridColumn column, DataGridRow row, RoutedEventArgs editingEventArgs, Control editingElement) { Column = column; Row = row; EditingEventArgs = editingEventArgs; EditingElement = editingElement; } /// /// Gets the column that contains the cell to be edited. /// public DataGridColumn Column { get; private set; } /// /// Gets the element that the column displays for a cell in editing mode. /// public Control EditingElement { get; private set; } /// /// Gets information about the user gesture that caused the cell to enter edit mode. /// public RoutedEventArgs EditingEventArgs { get; private set; } /// /// Gets the row that contains the cell to be edited. /// public DataGridRow Row { get; private set; } } /// /// EventArgs used for the DataGrid's LoadingRowGroup and UnloadingRowGroup events /// public class DataGridRowGroupHeaderEventArgs : EventArgs { /// /// Constructs a DataGridRowGroupHeaderEventArgs instance /// /// public DataGridRowGroupHeaderEventArgs(DataGridRowGroupHeader rowGroupHeader) { RowGroupHeader = rowGroupHeader; } /// /// DataGridRowGroupHeader associated with this instance /// public DataGridRowGroupHeader RowGroupHeader { get; private set; } } /// /// Provides data for the , , /// and events. /// public class DataGridRowDetailsEventArgs : EventArgs { /// /// Initializes a new instance of the class. /// /// The row that the event occurs for. /// The row details section as a framework element. public DataGridRowDetailsEventArgs(DataGridRow row, IControl detailsElement) { Row = row; DetailsElement = detailsElement; } /// /// Gets the row details section as a framework element. /// public IControl DetailsElement { get; private set; } /// /// Gets the row that the event occurs for. /// public DataGridRow Row { get; private set; } } }