Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

StrokeCollection.ContainsPropertyData Method

Returns whether the specified custom property identifier is in the StrokeCollection.

Namespace:  System.Windows.Ink
Assembly:  PresentationCore (in PresentationCore.dll)

public bool ContainsPropertyData(
	Guid propertyDataId
)

Parameters

propertyDataId
Type: System.Guid

The Guid to locate in the StrokeCollection.

Return Value

Type: System.Boolean
true if the specified custom property identifier is in the StrokeCollection; otherwise, false.

The following example demonstrates how to check for custom property in a StrokeCollection. If a custom property has been associated with timestamp, the example gets that custom property and shows when the StrokeCollection was saved. This example assumes that there is an InkCanvas called inkCanvas1.

Guid timestamp = new Guid("12345678-9012-3456-7890-123456789012");

// Add a timestamp to the StrokeCollection. 
private void AddTimestamp_Click(object sender, RoutedEventArgs e)
{

    inkCanvas1.Strokes.AddPropertyData(timestamp, DateTime.Now);
}

// Get the timestamp of the StrokeCollection. 
private void GetTimestamp_Click(object sender, RoutedEventArgs e)
{

    if (inkCanvas1.Strokes.ContainsPropertyData(timestamp))
    {
        object date = inkCanvas1.Strokes.GetPropertyData(timestamp);

        if (date is DateTime)
        {
            MessageBox.Show("This StrokeCollection's timestamp is " +
                ((DateTime)date).ToString());
        }
    }
    else
    {
        MessageBox.Show(
            "The StrokeCollection does not have a timestamp.");
    }
}

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft