Version

Prevent Clipboard Operations From Modifying a Field

If you enable clipboard operations that can modify a cell’s value, such as cut, paste, and/or clear cell contents, you can prevent these operations from modifying values in a specific field by setting the Field object’s DisallowModificationViaClipboard property to True. For example, if you enable the paste operation, you may want to prevent your end users from pasting data into a read-only field or a primary-key field.

The following example code demonstrates how to prevent clipboard operations from modifying a field.

In XAML:

<igDP:XamDataPresenter Name="xamDataPresenter1" BindToSampleData="True">
    <igDP:XamDataPresenter.FieldLayoutSettings>
        <igDP:FieldLayoutSettings AllowClipboardOperations="All" />
    </igDP:XamDataPresenter.FieldLayoutSettings>
    <igDP:XamDataPresenter.FieldLayouts>
        <igDP:FieldLayout>
            <igDP:FieldLayout.Fields>
                <igDP:Field Name="name" DisallowModificationViaClipboard="True" />
            </igDP:FieldLayout.Fields>
        </igDP:FieldLayout>
    </igDP:XamDataPresenter.FieldLayouts>
</igDP:XamDataPresenter>

In Visual Basic:

...
'This code assumes you are bound to the sample data provided by xamDataPresenter
Me.xamDataPresenter1.FieldLayouts(0).Fields("name"). DisallowModificationViaClipboard = True
...

In C#:

...
//This code assumes you are bound to the sample data provided by xamDataPresenter
this.xamDataPresenter1.FieldLayouts[0].Fields["name"]. DisallowModificationViaClipboard = true;
...