AnnotationStore.DeleteAnnotation(Guid) Metoda

Definicja

Usuwa adnotację z określoną Id wartością ze sklepu.

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

Parametry

annotationId
Guid

Właściwość GUID Id adnotacji do usunięcia.

Zwraca

Adnotacja, która została usunięta; w przeciwnym razie, null jeśli adnotacja z określonym annotationId elementem nie została znaleziona w magazynie.

Wyjątki

Dispose został wywołany w sklepie.

Przykłady

W poniższym przykładzie pokazano użycie DeleteAnnotation metod i 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();
}

Dotyczy

Zobacz też