Back to Devexpress

ClipboardAccessPolicy Class

corelibraries-devexpress-dot-data-dot-utils-74fa9e1f.md

latest3.8 KB
Original Source

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.v25.2.dll

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

Declaration

csharp
public static class ClipboardAccessPolicy
vb
Public Module ClipboardAccessPolicy

Remarks

Use the following methods to apply a policy (call these methods at application startup):

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:

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.SuppressCopyOperations();
            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.SuppressCopyOperations()
            Application.Run(New Form1())
        End Sub
    End Module
End Namespace

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.

Inheritance

Object ClipboardAccessPolicy

See Also

Clipboard Access Policy

ClipboardAccessPolicy Members

DevExpress.Data.Utils Namespace