Important The information set out in this topic regarding Microsoft Word is presented exclusively for the benefit and use of individuals and organizations who are located outside the United States and its territories or who are using, or developing programs that run on, Microsoft Word products that were licensed by Microsoft before January 2010, when Microsoft removed an implementation of particular functionality related to custom XML from Microsoft Word. This information regarding Microsoft Word may not be read or used by individuals or organizations in the United States or its territories who are using, or developing programs that run on, Microsoft Word products that were licensed by Microsoft after January 10, 2010; those products will not behave the same as products licensed before that date or purchased and licensed for use outside the United States.
Applies to: The information in this topic applies to document-level projects for Word 2013 and Word 2010. For more information, see Features Available by Office Application and Project Type.
The XMLNode control is a mapped XML node object that exposes events and can be bound to data. The XMLNode control is created only when a non-repeating schema element is mapped onto a Microsoft Office Word document. After Visual Studio creates the XML node, you can program against it directly without having to traverse the Word object model.
The XMLNode control can be deleted only by removing the element mapping in Word.
You can capture an event when the user moves his or her cursor inside the context of a particular XMLNode control. For example, you might have an XMLNode control named Customer that has a child XMLNode control named Company, and Company has two child XMLNode controls named CompanyName and CompanyRegion as follows:
<Customer> <Company> <CompanyName> <CompanyRegion>
If you want to show a control on the actions pane whenever the cursor is moved into the Company node, it should not matter whether the cursor is placed in CompanyName or CompanyRegion because they are both within the context of Company. In this case, you can write your code in the ContextEnter event of Company.
Occurs when the cursor is placed inside an XMLNode.
Occurs when the cursor is placed inside an XMLNode or one of its descendent nodes, from an area outside of the context of the node. In other words, it is raised only when the context changes.
For example, when you move the cursor from outside of Customer into CompanyName, the ContextEnter event for Customer, Company, and CompanyName is raised. If you then move the cursor from CompanyName to CompanyRegion, only the ContextEnter event for CompanyRegion is raised because you are still within the context of both Company and Customer.