tony turner

tony turner

  • NA
  • 4
  • 2.7k

using a Variable to set control properties

Dec 12 2010 5:05 AM

Hi I am wanting to set the border colour of a control depending on a condition at runtime
normally you would set it with the following statement which is fixed

 LGB00.BorderBrush = new SolidColorBrush(Colors.Red);

what I would like to do is set the colour depending on which condition is met ie

below is not actual code but what I want to do

string back;

if (x== 1) back = Red;
if (x == 2 back =orange

LGB00.BorderBrush = new SolidColorBrush(Colors.back); // somehow use the contents of back to set color

while on the subject of variables is it possible where I have "LGB00.BorderBrush" to us a variable that contains the string rather than the string itself so that i can be used in a loop to change multiple controls.

I'm an old machine code programmer and can do this depending on the syntax choice of imediate, relative, or contents of

( motorola 6809, 68hc11, 68hc05,)  tried scoring the net but can't find answer just get plenty of error messages for my effort

cheers tony




Answers (3)