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.
In most cases, when the cursor enters an XMLNode control, both the Select and ContextEnter events are raised. The following table shows the differences between these events.
Select Event | ContextEnter Event |
|---|
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.
The same differences exist between the ContextLeave event and Deselect event.