سؤال

The heading may not clearly explain what I'm trying to achieve. This is what I need. I have an array of strings. There is a UI element with that name. Eg arr[0] has Ach. There is a checkbox with name Ach.

How do I use the string Ach and refer it to the checkbox named Ach?

هل كانت مفيدة؟

المحلول

You can try to use FrameworkElement.FindName() method passing control name as method parameter, for example :

var ach = (CheckBox)this.FindName(arr[0]);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top