XAML
C#
XAML.CS
C#
gTBxComment.Background = ???How do I change the background of a TextBox to another color?
XAML
XAML.CS
gTBxComment.Background = ???How do I change the background of a TextBox to another color?
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jaish MathewsRank #225 · 11K reputationPosted Dec 8, 2024, 11:26 AM EST
You try this
gTBxComment.Background = new SolidColorBrush(Color.FromRgb(255, 192, 203)); // Example: Light Pinkor try this
gTBxComment.Background = new SolidColorBrush(Colors.LightBlue); // Predefined colorSolidColorBrush: Used to define a solid fill color.Color.FromRgb: Allows you to specify the RGB values for the color.Colors: Provides a list of predefined colors.Amit MohantyRank #112 · 20K reputationPosted Dec 9, 2024, 12:46 AM EST
Try this:
gTBxComment.Background = Brushes.LightBlue; // Replace with your desired color gTBxComment.Background = new SolidColorBrush(Color.FromRgb(255, 255, 204)); // Example: Light Yellow gTBxComment.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString("#FFB6C1")); // Example: Light Pink