AnnotationStore.DeleteAnnotation(Guid) メソッド

定義

指定された 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

パラメーター

annotationId
Guid

削除する注釈の GUID Id プロパティ。

戻り値

削除された注釈。指定した null を持つ注釈がストア内で見つからなかった場合は annotationId

例外

Dispose はストアに呼び出されました。

次の例は、 メソッドと Flush メソッドの使用をDeleteAnnotation示しています。

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

適用対象

こちらもご覧ください