Reputation: 165
I'm in the middle of creating a Universal Windows Platform (UWP) app. It's all gone smoothly, apart from this one issue which has got me really scratching my head over.
All I'm trying to do is set the background of a textbox to be 100% opaque. I've tried setting this in the XAML for the TextBox:
<Textbox Background="SteelBlue" Opacity="1"/>
But it comes out as some semi-transparent colour.
I've looked in the property editor, and it definitely says 100% Opacity.
But it comes out as semi-transparent, all the time. Just seems to be textboxes that are affected by this.
Has anyone else experienced this before?
Thanks in advance for any help you can give.
Upvotes: 2
Views: 900
Reputation: 23280
So if we go check out the default style template we see a Border
control as x:Name="BackgroundElement"
that just happens to have an Opacity dependency property pointed via Opacity="{ThemeResource TextControlBackgroundRestOpacity}"
While I'm not quite sure why it has this, or where TextControlBackgroundRestOpacity
lives off the top of my head. You could go find it in your solution and change the value, or just go hit the style template and pull it out or change the ThemeResource TextControlBackgroundRestOpacity
to TemplateBinding Opacity
and give it a default Setter so when you set it at the instance it will actually show that change on the control. Hope this helps and welcome to SO.
Upvotes: 1