0

I am designing an application and had to instantiate controls via code. The problem is that I am unable to change the background color. I tried to look all over the internet, but no succes. I have contacted the Microsoft support service, but no succes either.

I read that you normally change a color by using System.Color or System.ColorHelper. Both are not accesible in the application.

So how to solve the following problem:

TextBox^ txtID = ref new TextBox();
txtID->Background = ?; 
pnuts
  • 58,317
  • 11
  • 87
  • 139
Napokue
  • 105
  • 13

1 Answers1

1

I have the solution, first make a brush object and set the color and assign that color to your controls background. I used the following:

SolidColorBrush^ myBrush = ref new SolidColorBrush(Windows::UI::Colors::Red);
TextBox^ txtID = ref new TextBox();
txtID->Background = myBrush;
Napokue
  • 105
  • 13