XmlStreamStore.DeleteAnnotation(Guid) Méthode

Définition

Supprime l'annotation avec la Id spécifiée du magasin.

public:
 override System::Windows::Annotations::Annotation ^ DeleteAnnotation(Guid annotationId);
public override System.Windows.Annotations.Annotation DeleteAnnotation (Guid annotationId);
override this.DeleteAnnotation : Guid -> System.Windows.Annotations.Annotation
Public Overrides Function DeleteAnnotation (annotationId As Guid) As Annotation

Paramètres

annotationId
Guid

Propriété de l’identificateur global unique (GUID) Id de l’annotation à supprimer.

Retours

Annotation supprimée ; sinon, null si une annotation avec la annotationId spécifiée était introuvable dans le magasin.

Exceptions

Dispose a été appelé sur le magasin.

Aucun Stream E/S n'a été défini pour le magasin.

Exemples

L’exemple suivant montre l’utilisation DeleteAnnotation des méthodes et Flush .

// ------------------------- 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();
}

S’applique à

Voir aussi