StrokeCollection.GetPropertyData Method (Guid)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Returns the value of the custom property associated with the specified Guid.

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

public object GetPropertyData(
	Guid propertyDataId


Type: System.Guid

The Guid associated with the custom property to get.

Return Value

Type: System.Object

The value of the custom property associated with the specified Guid.

Exception Condition

propertyDataId is not associated with a custom property of the StrokeCollection.

The AddPropertyData and GetPropertyData methods enable you to add custom properties to a StrokeCollection. You can then include extra information with a StrokeCollection.

The following example demonstrates how to add and get custom property data. The AddTimeStamp_Click method uses the AddPropertyData method to add the current time to the StrokeCollection. The GetTimeStap_Click method uses the GetPropertyData method to retrieve the timestamp from the StrokeCollection. 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 " +
            "The StrokeCollection does not have a timestamp.");

.NET Framework
Available since 3.0
Return to top