InkCanvas.CanPaste Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Indicates whether the contents of the Clipboard can be pasted into the InkCanvas.

public bool CanPaste ();

Returns

true if the contents of the Clipboard can be pasted in; otherwise, false.

Examples

The following example copies an element to the Clipboard and pastes it to the InkCanvas. This example assumes that there is an element called rect1, and that the Click events have been connected to the event handlers in the example.

void copyXamlButton_Click(object sender, RoutedEventArgs e)
{
    string rectString = XamlWriter.Save(rect1);

    DataObject rectangleData = new DataObject(DataFormats.Xaml, rectString);
    Clipboard.SetDataObject(rectangleData);
}

void pasteButton_Click(object sender, RoutedEventArgs e)
{
    if (inkCanvas1.CanPaste())
    {
        inkCanvas1.Paste(new Point(100, 100));
    }
}

Remarks

The InkCanvas can support Clipboard data in Extensible Application Markup Language (XAML) format, Ink Serialized Format (ISF), and text format.

Applies to

Toode Versioonid
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

See also