AnnotationStore.DeleteAnnotation Method (Guid)


Deletes the annotation with the specified Id from the store.

Namespace:   System.Windows.Annotations.Storage
Assembly:  PresentationFramework (in PresentationFramework.dll)

public abstract Annotation DeleteAnnotation(
	Guid annotationId


Type: System.Guid

The globally unique identifier (GUID) Id property of the annotation to be deleted.

Return Value

Type: System.Windows.Annotations.Annotation

The annotation that was deleted; otherwise, null if an annotation with the specified annotationId was not found in the store.

Exception Condition

Dispose has been called on the store.

The following example shows use of the DeleteAnnotation and Flush methods.

// ------------------------- DeleteMark_Click -------------------------
void DeleteMark_Click(object sender, RoutedEventArgs e)
    Annotation ann = ((MenuItem)sender).Tag as Annotation;

    MenuItem thisMenu = sender as MenuItem;
    ContextMenu parentMenu = thisMenu.Parent as ContextMenu;
    FrameworkElement dObj =
        parentMenu.PlacementTarget as FrameworkElement;
    while (!(dObj is StackPanel))
        dObj = dObj.Parent as FrameworkElement;

    ListBox collection = dObj.Parent as ListBox;

.NET Framework
Available since 3.0
Return to top