Skip to Content
Author's profile photo Jerry Wang

How to find the location where control id is created in the runtime

In one of my blog How to monitor the control registration and deregistration ,

I demonstrate one approach to enable you to find the location where a given control which you are interested is created or destructed.

Still use the master list below for example:

/wp-content/uploads/2015/10/clipboard1_800868.png

In the xml view, its id is defined as “list”:

/wp-content/uploads/2015/10/clipboard2_800869.png

And in the runtime, the id has naming convention “__xmlview[id]–list”. Where is this runtime id generated?

/wp-content/uploads/2015/10/clipboard3_800870.png

Following the tips in my previous blog, we can easily find the callstack where control runtime id is generated.

By reading the code if seems the runtime id did consist of container xml view id and the control id itself defined in xml view.

/wp-content/uploads/2015/10/clipboard4_800871.png

In order to prove my assumption, I wrote the following code and re-launch my UI. This time the breakpoint is triggered, with the very list id “list” passed in.

/wp-content/uploads/2015/10/clipboard5_800872.png

After I debugged into function createId in line 334, I get my guess verified: the runtime id of a control consists of its container view’s id and its own id defined in the container view, as displayed below:

/wp-content/uploads/2015/10/clipboard6_800873.png

Assigned Tags

      Be the first to leave a comment
      You must be Logged on to comment or reply to a post.