Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Textbox with Semi-Transparent Background

Tags:

wpf

xaml

Semi-Transparent background of the Textbox is needed, and the text content should be shown as normal.

Style or Brush which can store in the Resource dictionary is good.

NOTE:

  1. My textBox is wrapped within a ContentControl.

  2. This similar question does not help. TextBox with a Transparent Background .

like image 309
dongx Avatar asked Feb 20 '13 16:02

dongx


People also ask

How do you make a text box semi transparent?

On the shortcut menu, click Format Text Box. On the Colors and Lines tab, in the Fill section, click the arrow next to Color, and then click No Color. On the Colors and Lines tab, in the Line section, click the arrow next to Color, and then click No Color. Click OK.

How do you make a text box semi transparent in Powerpoint?

First, place the shape over the text box to your desired position. Then, to make the ghost transparent, simply right click on the object, go to Format Shape, under shape options go to Fill & Line, look for the Transparency sliders and simply adjust the fill and line transparency to your liking. Simple.

How do I shade the background of a text box?

Select the shape or text box. On the Drawing Tools Format tab, click Text Fill > More Fill Colors. In the Colors box, either click the color you want on the Standard tab, or mix your own color on the Custom tab.

How do I change the transparency of a text box in Powerpoint?

To adjust the transparency of the shape, click More Fill Colors. At the bottom of the Colors dialog box, move the Transparency slider, or enter a number in the box next to the slider. You can vary the percentage of transparency from 0% (fully opaque, the default setting) to 100% (fully transparent).


1 Answers

In XAML you can set Background property to Transparent:

<TextBox Background="Transparent" />

In code-behind you can use following code:

TextBox tb = new TextBox 
{
    Width = 100,
    Background = Brushes.Transparent
};

If you want to set background to transparent to all TextBox you can use following style:

<Style TargetType="TextBox">
    <Setter Property="Background" Value="Transparent" />
</Style>
like image 145
kmatyaszek Avatar answered Nov 16 '22 00:11

kmatyaszek