ClipboardAccessPolicy Class
Allows you to control clipboard-related operations initiated by users and DevExpress UI controls for WinForms and WPF.
Namespace: DevExpress.Data.Utils
Assembly: DevExpress.Data.Desktop.v24.1.dll
NuGet Packages: DevExpress.Data.Desktop, DevExpress.ExpressApp.Win.Design
Declaration
Remarks
Use the following methods to apply a policy (call these methods at application startup):
- SuppressAllOperations()
- SuppressCopyOperations()
- SuppressPasteOperations()
- SuppressClearOperations()
- SuppressContainsOperations()
- ThrowAlways()
- ThrowOnErrors()
The following example demonstrates how to allow users to copy data in ANSI text format displayed in a DevExpress UI control to the clipboard. If the control displays data in a different format, the copy-to-clipboard operation is canceled:
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.SuppressCopyOperations();
Application.Run(new Form1());
}
}
}
You can also handle Copying, Pasting, and Clearing events to allow or cancel clipboard operations based on a specific condition.
Read the following topic for more information: Clipboard Access Policy.