Export (0) Print
Expand All

StrokeCollection.GetPropertyData Method

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.


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

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

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft