Udostępnij za pośrednictwem


ContentControlStoreUpdatingEventArgs Class (2007 System)

Provides data for the StoreUpdating event of a content control.

Namespace:  Microsoft.Office.Tools.Word
Assembly:  Microsoft.Office.Tools.Word.v9.0 (in Microsoft.Office.Tools.Word.v9.0.dll)

Syntax

'Declaration
Public Class ContentControlStoreUpdatingEventArgs _
    Inherits EventArgs
'Usage
Dim instance As ContentControlStoreUpdatingEventArgs
public class ContentControlStoreUpdatingEventArgs : EventArgs
public ref class ContentControlStoreUpdatingEventArgs : public EventArgs
public class ContentControlStoreUpdatingEventArgs extends EventArgs

Examples

The following code example demonstrates event handlers for the StoreUpdating and ContentUpdating events. This example assumes that the document contains a PlainTextContentControl named plainTextContentControl1 that is bound to an element in a custom XML part. For a code example that demonstrates how to bind a content control to an element in a custom XML part, see Walkthrough: Binding Content Controls to Custom XML Parts.

To use this code, paste it into the ThisDocument class in your project. For C#, you must also attach the event handlers to the StoreUpdating and ContentUpdating events of plainTextContentControl1.

This example is for a document-level customization.

Private Sub plainTextContentControl1_StoreUpdating(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs) _
    Handles PlainTextContentControl1.StoreUpdating

    MessageBox.Show("The control was changed to the following value: " & vbCrLf & _
        e.Content & vbCrLf & "This value is about to be written to the node that is bound to this control.")
End Sub 

Private Sub plainTextContentControl1_ContentUpdating(ByVal sender As Object, _
    ByVal e As Microsoft.Office.Tools.Word.ContentControlContentUpdatingEventArgs) _
    Handles PlainTextContentControl1.ContentUpdating

    MessageBox.Show("The node that is bound to this control was changed to the following value: " & vbCrLf & _
        e.Content & vbCrLf & "This value is about to be written to this control.")
End Sub
void plainTextContentControl1_StoreUpdating(object sender, 
    Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs e)
{
    MessageBox.Show("The control was changed to the following value: \n\n" +
        e.Content + "\n\nThis value is about to be written to the node that is bound to this control.");
}

void plainTextContentControl1_ContentUpdating(object sender, 
    Microsoft.Office.Tools.Word.ContentControlContentUpdatingEventArgs e)
{
    MessageBox.Show("The node that is bound to this control was changed to the following value: \n\n" +
        e.Content + "\n\nThis value is about to be written to this control.");
}

Inheritance Hierarchy

System.Object
  System.EventArgs
    Microsoft.Office.Tools.Word.ContentControlStoreUpdatingEventArgs

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

See Also

Reference

ContentControlStoreUpdatingEventArgs Members

Microsoft.Office.Tools.Word Namespace

Other Resources

Content Controls

Custom XML Parts Overview

Walkthrough: Binding Content Controls to Custom XML Parts