Browse Source

Fix Placeholder not visible (#21024)

* Add default PlaceholderForeground to AutoCompleteBox, CalendarDatePicker and NumericUpDown.

* Add PlaceholderText template binding for simple theme ComboBox PART_EditableTextBox.
pull/21042/head
shine 7 months ago
committed by GitHub
parent
commit
75b0676d05
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 1
      src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml
  2. 1
      src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml
  3. 1
      src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml
  4. 1
      src/Avalonia.Themes.Simple/Controls/AutoCompleteBox.xaml
  5. 1
      src/Avalonia.Themes.Simple/Controls/CalendarDatePicker.xaml
  6. 1
      src/Avalonia.Themes.Simple/Controls/ComboBox.xaml
  7. 1
      src/Avalonia.Themes.Simple/Controls/NumericUpDown.xaml

1
src/Avalonia.Themes.Fluent/Controls/AutoCompleteBox.xaml

@ -25,6 +25,7 @@
<Setter Property="VerticalAlignment" Value="Top" /> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" /> <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" /> <Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextControlPlaceholderForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />

1
src/Avalonia.Themes.Fluent/Controls/CalendarDatePicker.xaml

@ -63,6 +63,7 @@
<ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker"> <ControlTheme x:Key="{x:Type CalendarDatePicker}" TargetType="CalendarDatePicker">
<Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" /> <Setter Property="Background" Value="{DynamicResource CalendarDatePickerBackground}" />
<Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" /> <Setter Property="Foreground" Value="{DynamicResource CalendarDatePickerForeground}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextControlPlaceholderForeground}" />
<Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource CalendarDatePickerBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource CalendarDatePickerBorderThemeThickness}" />
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" /> <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />

1
src/Avalonia.Themes.Fluent/Controls/NumericUpDown.xaml

@ -52,6 +52,7 @@
<ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown"> <ControlTheme x:Key="{x:Type NumericUpDown}" TargetType="NumericUpDown">
<Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" /> <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
<Setter Property="Background" Value="{DynamicResource TextControlBackground}" /> <Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource TextControlPlaceholderForeground}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" />
<Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
<Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" /> <Setter Property="MinHeight" Value="{DynamicResource TextControlThemeMinHeight}" />

1
src/Avalonia.Themes.Simple/Controls/AutoCompleteBox.xaml

@ -4,6 +4,7 @@
<ControlTheme x:Key="{x:Type AutoCompleteBox}" <ControlTheme x:Key="{x:Type AutoCompleteBox}"
TargetType="AutoCompleteBox"> TargetType="AutoCompleteBox">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />

1
src/Avalonia.Themes.Simple/Controls/CalendarDatePicker.xaml

@ -12,6 +12,7 @@
<ControlTheme x:Key="{x:Type CalendarDatePicker}" <ControlTheme x:Key="{x:Type CalendarDatePicker}"
TargetType="CalendarDatePicker"> TargetType="CalendarDatePicker">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />

1
src/Avalonia.Themes.Simple/Controls/ComboBox.xaml

@ -50,6 +50,7 @@
Foreground="{TemplateBinding Foreground}" Foreground="{TemplateBinding Foreground}"
Background="Transparent" Background="Transparent"
Text="{TemplateBinding Text, Mode=TwoWay}" Text="{TemplateBinding Text, Mode=TwoWay}"
PlaceholderText="{TemplateBinding PlaceholderText}"
BorderThickness="0" BorderThickness="0"
IsVisible="{TemplateBinding IsEditable}"> IsVisible="{TemplateBinding IsEditable}">
<TextBox.Resources> <TextBox.Resources>

1
src/Avalonia.Themes.Simple/Controls/NumericUpDown.xaml

@ -4,6 +4,7 @@
<ControlTheme x:Key="{x:Type NumericUpDown}" <ControlTheme x:Key="{x:Type NumericUpDown}"
TargetType="NumericUpDown"> TargetType="NumericUpDown">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" /> <Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
<Setter Property="PlaceholderForeground" Value="{DynamicResource ThemeForegroundLowBrush}" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" /> <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" /> <Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}" />
<Setter Property="Padding" Value="4" /> <Setter Property="Padding" Value="4" />

Loading…
Cancel
Save