次の方法で共有


XmlStreamStore.DeleteAnnotation(Guid) メソッド

定義

指定された Id を持つ注釈をストアから削除します。

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

パラメーター

annotationId
Guid

削除される注釈のグローバル一意識別子 (GUID) Id プロパティ。

戻り値

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

例外

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

ストアに対して I/O Stream が設定されていません。

次の例では、 メソッドと 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();
}

適用対象

こちらもご覧ください