Skip to main content
All docs
V23.2

DocumentPreviewControl.ShowingEditingFieldEditor Event

Occurs when the editor for the edit field is about to be shown. Allows you to prevent the editor from being displayed.

Namespace: DevExpress.Xpf.Printing

Assembly: DevExpress.Xpf.Printing.v23.2.dll

NuGet Package: DevExpress.Wpf.Printing

Declaration

public event ShowingEditingFieldEditorEventHandler ShowingEditingFieldEditor

Event Data

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

Property Description
Cancel Gets or sets a value that indicates whether the editor should be opened.
EditingField Gets the edit field for which the event is raised. Inherited from EditingFieldEditorEventArgsBase.
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.
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.
Source Gets or sets a reference to the object that raised the event. Inherited from RoutedEventArgs.

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 following code prevents the editors for the Check Box and Picture Box fields from being displayed:

<Window x:Class="ValidateEditingFields_MVVM.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:ValidateEditingFields_MVVM"
        xmlns:dxp="http://schemas.devexpress.com/winfx/2008/xaml/printing"
        xmlns:dxmvvm="http://schemas.devexpress.com/winfx/2008/xaml/mvvm"
        Title="MainWindow" Height="450" Width="800">
    <Window.DataContext>
        <local:ViewModel />
    </Window.DataContext>
    <Grid>
        <dxp:DocumentPreviewControl RequestDocumentCreation="True"
                                    DocumentSource="{Binding Report}"
                                    HighlightEditingFields="True">
            <dxmvvm:Interaction.Behaviors>
                <dxmvvm:EventToCommand Event="{x:Static dxp:DocumentPreviewControl.ShowingEditingFieldEditorEvent}"
                                       PassEventArgsToCommand="True"
                                       Command="{Binding OnShowingEditingFieldEditorCommand}" />
            </dxmvvm:Interaction.Behaviors>
        </dxp:DocumentPreviewControl>
    </Grid>
</Window>
using DevExpress.Mvvm;
using DevExpress.Mvvm.DataAnnotations;
using DevExpress.Xpf.Printing;
using DevExpress.XtraReports.UI;
using System;

namespace ValidateEditingFields_MVVM {
    public class ViewModel : ViewModelBase {
        [Command]
        public void OnShowingEditingFieldEditor(ShowingEditingFieldEditorEventArgs args) {
            if(args.EditingField.ID == "CheckField" || args.EditingField.ID == "ImageField")
                args.Cancel = true;
        }
    }
}

View Example: How to Validate the Editing Field Value in the Document Preview

See Also