Click here to Skip to main content
15,884,629 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi all,
I am trying to set the Textbox control's color in runtime like;

TextBox1.Foreground = Brush.White;

I get an Error: 'System.Windows.Media.Brush' Does not contain a difinition for 'White'

The Code is:
C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.Windows.Threading;

namespace Test1
{
    public partial class MainPage : PhoneApplicationPage
    {
	private DispatcherTimer _timer;
        

        public MainPage()
        {
            InitializeComponent();
        }

        public void RefreshUI(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;
            if (dt.Day == 1)
            {
                TextBox1.Foreground = Brush.White;
            }
        }
    }
}


Thanks in advance.
Posted

1 solution

 
Share this answer
 
Comments
Dave Crump 21-Aug-12 0:13am    
Thank you, I was in this MSDN page, but still I don't know how to set the Brush.
Can you help me with an example?
Sergey Alexandrovich Kryukov 21-Aug-12 1:08am    
Can you read, anyway? Kenneth told you exactly: Change "Brush" into "Brushes". If you failed to see it in the two-line answer, I can imagine how successful could be your reading of MSDN. I don't believe you have such a big cognitive problem; perhaps, just slow down.
--SA
Sergey Alexandrovich Kryukov 21-Aug-12 1:09am    
5ed.
--SA
Kenneth Haugland 21-Aug-12 1:24am    
Thanks Sergey :)
Kenneth Haugland 21-Aug-12 14:48pm    
OP has a remark to you, see below :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900