Bahasa

XmlStreamStore.DeleteAnnotation(Guid) Metode

Definisi

Menghapus anotasi dengan yang ditentukan Id dari penyimpanan.

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

Parameter

annotationId
Guid

Properti pengidentifikasi unik global (GUID) Id dari anotasi yang akan dihapus.

Mengembalikan

Anotasi yang dihapus; jika tidak, null jika anotasi dengan yang ditentukan annotationId tidak ditemukan di penyimpanan.

Pengecualian

Dispose telah dipanggil di toko.

I/O Stream belum ditetapkan untuk penyimpanan.

Contoh

Contoh berikut menunjukkan penggunaan DeleteAnnotation metode dan 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();
}

Berlaku untuk

Lihat juga