I am trying to change background color of grid (with name "colorPlace") in my simple app (when I click on button). I tried (where red, green and blue are bytes):
colorPlace.Background = new SolidColorBrush(Color.FromArgb(255, red, green, blue));
and:
colorPlace.SetValue(BackgroundProperty, "#FFFFFFFF");
And all I just get is:
An exception of type 'System.NullReferenceException' occurred in Project.DLL but was not handled in user code
Any ideas how to do it?
EDIT: Oh, I just find an solution - all changes in elements (grid, buttons etc.) should be done AFTER InitializeComponent();
line.