Skip to main content
All docs
V25.2
  • TreeListView.CellEditorValueChanging Event

    Occurs when the cell editor value is changed and allows you to cancel changes.

    Namespace: DevExpress.Xpf.Grid

    Assembly: DevExpress.Xpf.Grid.v25.2.dll

    Declaration

    public event TreeListCellEditorValueChangingEventHandler CellEditorValueChanging

    Event Data

    The CellEditorValueChanging event's data class is TreeListCellEditorValueChangingEventArgs. The following properties provide information specific to this event:

    Property Description
    Cancel Gets or sets whether the CellEditorValueChanging event is canceled.
    Cell Gets a processed cell. Inherited from TreeListCellValueEventArgs.
    Column Gets a column that contains the edited cell. Inherited from TreeListCellValueEventArgs.
    Handled Gets or sets a value that indicates the present state of the event handling for a routed event as it travels the route. Inherited from RoutedEventArgs.
    Node Gets the processed node. Inherited from TreeListNodeEventArgs.
    OldValue Gets the cell’s previous value. Inherited from TreeListCellValueChangedEventArgs.
    OriginalSource Gets the original reporting source as determined by pure hit testing, before any possible Source adjustment by a parent class. Inherited from RoutedEventArgs.
    RoutedEvent Gets or sets the RoutedEvent associated with this RoutedEventArgs instance. Inherited from RoutedEventArgs.
    Row Gets the processed row. Inherited from TreeListNodeEventArgs.
    Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.
    Value Gets or sets the processed cell’s value. Inherited from TreeListCellValueEventArgs.

    The event data class exposes the following methods:

    Method Description
    InvokeEventHandler(Delegate, Object) When overridden in a derived class, provides a way to invoke event handlers in a type-specific way, which can increase efficiency over the base implementation. Inherited from RoutedEventArgs.
    OnSetSource(Object) When overridden in a derived class, provides a notification callback entry point whenever the value of the Source property of an instance changes. Inherited from RoutedEventArgs.

    Remarks

    The CellEditorValueChanging event is raised only when a user modifies a cell value using an in-place editor (a user types or deletes a character, chooses a value from a drop-down list, etc.). You cannot raise the event in code.

    To restore the previous cell editor value (and prevent the CellValueChanging event from occurring), set the Cancel property to true.

    Example

    The following example prompts a user before changing a cell value (if the action is canceled, the cell value remains unchanged):

    <ThemedWindow ...
        xmlns:dx="http://schemas.devexpress.com/winfx/2008/xaml/core"
        xmlns:dxg="http://schemas.devexpress.com/winfx/2008/xaml/grid">
        <Grid>
            <dxg:TreeListControl ItemsSource="{Binding DataItems}">
                <dxg:TreeListControl.Columns>
                    <dxg:TreeListColumn FieldName="Name"/>
                    <dxg:TreeListColumn FieldName="Executor"/>
                    <dxg:TreeListColumn FieldName="State"/>
                </dxg:TreeListControl.Columns>
                <dxg:TreeListControl.View>
                    <dxg:TreeListView  
                        TreeDerivationMode="ChildNodesSelector" 
                        ChildNodesPath="Tasks"
                        CellEditorValueChanging="OnStateCellEditorChanging"/>
                </dxg:TreeListControl.View>
            </dxg:TreeListControl>
        </Grid>
    </ThemedWindow>
    
    void OnStateCellEditorChanging(object sender, TreeListCellEditorValueChangingEventArgs e) {
        if (e.Column.FieldName == "State") {
            var result = MessageBox.Show(
                "Would you like to change the State value?",
                "Warning",
                MessageBoxButton.OKCancel,
                MessageBoxImage.Question,
                MessageBoxResult.OK
            );
            e.Cancel = (result == MessageBoxResult.Cancel);
        }
    }
    
    See Also