Why control.FindName is faster than iterating

  • Thread starter Thread starter zequion1
  • Start date Start date
Z

zequion1

Guest
I have a xaml form with about 100 controls and I have created a .dll with functions that use those controls. When I start the program I have a function that iterates to retrieve all the controls and, according to the name, introduces them in an index. This operation takes 7 seconds whereas if I compare it with control.findname ("MyName") the result is instantaneous.

It is evident that Findname does not iterate through the xaml page to find the control but rather accesses some array to retrieve it. What is the secret?

How can I retrieve all the controls by name without waiting so long?

On the other hand, I comment that a few weeks ago the WPF forum was crashing and no questions could be asked for weeks and now the forum has moved to something called Microsof Q&A. Besides, almost no one responds. Can the forum be put back here?

Continue reading...
 
Back
Top