Browse Source
Added resource for TextControlPlaceholderOpacity (#19705 )
* Added resource for TextControlPlaceholderOpacity
This allows overriding of the opacity instead of it being hardcoded to 50%.
* Added `TextControlPlaceholderOpacity` to Simple theme TextBox
pull/19712/head
Melissa
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with
5 additions and
2 deletions
src/Avalonia.Themes.Fluent/Accents/FluentControlResources.xaml
src/Avalonia.Themes.Fluent/Controls/TextBox.xaml
src/Avalonia.Themes.Simple/Accents/Base.xaml
src/Avalonia.Themes.Simple/Controls/TextBox.xaml
@ -249,6 +249,7 @@
<StaticResource x:Key="TextControlBackgroundDisabled" ResourceKey="SystemControlBackgroundBaseLowBrush" />
<StaticResource x:Key="TextControlBorderBrushFocused" ResourceKey="SystemControlHighlightAccentBrush" />
<StaticResource x:Key="TextControlBorderBrushDisabled" ResourceKey="SystemControlDisabledBaseLowBrush" />
<x:Double x:Key="TextControlPlaceholderOpacity">0.5</x:Double>
<StaticResource x:Key="TextControlPlaceholderForeground" ResourceKey="SystemControlPageTextBaseMediumBrush" />
<StaticResource x:Key="TextControlPlaceholderForegroundPointerOver"
ResourceKey="SystemControlPageTextBaseMediumBrush" />
@ -145,7 +145,7 @@
BringIntoViewOnFocusChange="{TemplateBinding (ScrollViewer.BringIntoViewOnFocusChange)}">
<Panel>
<TextBlock Name="PART_Watermark"
Opacity="0.5 "
Opacity="{DynamicResource TextControlPlaceholderOpacity} "
Text="{TemplateBinding Watermark}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}"
@ -151,4 +151,6 @@
<sys:Double x:Key="IconElementThemeHeight">20</sys:Double>
<sys:Double x:Key="IconElementThemeWidth">20</sys:Double>
<sys:Double x:Key="TextControlPlaceholderOpacity">0.5</sys:Double>
</ResourceDictionary>
@ -136,7 +136,7 @@
<TextBlock Name="watermark"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
Opacity="0.5 "
Opacity="{DynamicResource TextControlPlaceholderOpacity} "
Text="{TemplateBinding Watermark}"
TextAlignment="{TemplateBinding TextAlignment}"
TextWrapping="{TemplateBinding TextWrapping}">