Share via


XmlStreamStore.DeleteAnnotation(Guid) Método

Definición

Elimina la anotación con el Id especificado del almacén.

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

Parámetros

annotationId
Guid

Propiedad Id del identificador único global (GUID) de la anotación que se va a eliminar.

Devoluciones

Anotación eliminada; en caso contrario, null si no se encuentra ninguna anotación con el annotationId especificado en el almacén.

Excepciones

Dispose se ha llamado en el almacén.

No se ha establecido una Stream de E/S para el almacén.

Ejemplos

En el ejemplo siguiente se muestra el uso de los DeleteAnnotation métodos y 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();
}

Se aplica a

Consulte también