Back to Devexpress

ClipboardAccessPolicy.SuppressPasteOperations() Method

corelibraries-devexpress-dot-data-dot-utils-dot-clipboardaccesspolicy-59768a78.md

latest3.5 KB
Original Source

ClipboardAccessPolicy.SuppressPasteOperations() Method

Applies a policy to suppress all paste-from-clipboard operations within DevExpress WinForms and WPF controls.

Namespace : DevExpress.Data.Utils

Assembly : DevExpress.Data.Desktop.v25.2.dll

NuGet Packages : DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design

Declaration

csharp
public static void SuppressPasteOperations()
vb
Public Shared Sub SuppressPasteOperations

Remarks

Use the SuppressPateOperations method to prevent users from pasting data into DevExpress controls in Windows Forms and WPF applications from the clipboard. Call the SuppressPasteOperations method at application startup.

csharp
using System;
using System.Windows.Forms;
using DevExpress.Data.Utils;

namespace DXApplication {
    internal static class Program {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            ClipboardAccessPolicy.SuppressPasteOperations();
            Application.Run(new Form1());
        }
    }
}
vb
Imports System
Imports System.Windows.Forms
Imports DevExpress.Data.Utils

Namespace DXApplication
    Friend Module Program
        ''' <summary>
        ''' The main entry point for the application.
        ''' </summary>
        <STAThread>
        Sub Main()
            Application.EnableVisualStyles()
            Application.SetCompatibleTextRenderingDefault(False)
            ClipboardAccessPolicy.SuppressPasteOperations()
            Application.Run(New Form1())
        End Sub
    End Module
End Namespace

The Clipboard Access Policy fires the Pasting event when a user attempts to paste data from the clipboard and allows you to allow (or cancel) the operation based on a specific condition. If you disabled paste-from-clipboard operations, set the e.Cancel parameter to false to allow the operation.

Read the following topic for additional information: Clipboard Access Policy.

See Also

SuppressAllOperations()

SuppressCopyOperations()

SuppressClearOperations()

SuppressContainsOperations()

ClipboardAccessPolicy Class

ClipboardAccessPolicy Members

DevExpress.Data.Utils Namespace