If you want to set a semi-transparent background in code-behind you can do this
use a dependency prop on a class that inherits from TextBox
public static readonly DependencyProperty BgColourProperty =
DependencyProperty.Register("BgColour", typeof(SolidColorBrush), typeof(myTextBox), null);
public SolidColorBrush BgColour
{
get { return (SolidColorBrush)GetValue(BgColourProperty); }
set { SetValue(BgColourProperty, value); }
}
then set whatever colour you wish using Color.FromArgb() where 1st argument is Alpha component
myTextBox.BgColour = new SolidColorBrush(Color.FromArgb(120,240, 17, 17));