XmlStreamStore.DeleteAnnotation(Guid) Method

Definition

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Deletes the annotation with the specified Id from the store.

C#
public override System.Windows.Annotations.Annotation DeleteAnnotation(Guid annotationId);

Parameters

annotationId
Guid

The globally unique identifier (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.

An I/O Stream has not been set for the store.

Examples

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

C#
// ------------------------- 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

Product Versions
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

See also