ערוך

שתף באמצעות


AnnotationStore.DeleteAnnotation(Guid) Method

Definition

Deletes the annotation with the specified Id from the store.

public:
 abstract System::Windows::Annotations::Annotation ^ DeleteAnnotation(Guid annotationId);
public abstract System.Windows.Annotations.Annotation DeleteAnnotation (Guid annotationId);
abstract member DeleteAnnotation : Guid -> System.Windows.Annotations.Annotation
Public MustOverride Function DeleteAnnotation (annotationId As Guid) As Annotation

Parameters

annotationId
Guid

The GUID Id property of the annotation to be deleted.

Returns

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

Exceptions

Dispose has been called on the store.

Examples

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;
    _annStore.DeleteAnnotation(ann.Id);
    _annStore.Flush();

    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;
    collection.Items.Remove(dObj);
    Util.FlushDispatcher();
}

Applies to

See also