AnnotationStore.DeleteAnnotation(Guid) Méthode
Définition
Important
Certaines informations portent sur la préversion du produit qui est susceptible d’être en grande partie modifiée avant sa publication. Microsoft exclut toute garantie, expresse ou implicite, concernant les informations fournies ici.
Supprime l’annotation avec le magasin spécifié Id .
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
Paramètres
Retours
Annotation qui a été supprimée ; sinon, null si une annotation avec l’objet spécifié annotationId n’a pas été trouvée dans le magasin.
Exceptions
Dispose a été appelé sur le magasin.
Exemples
L’exemple suivant montre l’utilisation des méthodes et DeleteAnnotation des Flush méthodes.
// ------------------------- 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();
}