feat: update AutoCompleteBox theme.

This commit is contained in:
rabbitism 2023-02-15 16:25:38 +08:00
parent 7762eff214
commit ada894e456
4 changed files with 40 additions and 10 deletions

View File

@ -24,6 +24,26 @@
</DataTemplate>
</AutoCompleteBox.ItemTemplate>
</AutoCompleteBox>
<AutoCompleteBox
Classes="Large"
Items="{Binding States}"
ValueMemberBinding="{Binding Name, x:DataType=local:StateData}">
<AutoCompleteBox.ItemTemplate>
<DataTemplate DataType="local:StateData">
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</AutoCompleteBox.ItemTemplate>
</AutoCompleteBox>
<AutoCompleteBox
Classes="Small"
Items="{Binding States}"
ValueMemberBinding="{Binding Name, x:DataType=local:StateData}">
<AutoCompleteBox.ItemTemplate>
<DataTemplate DataType="local:StateData">
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</AutoCompleteBox.ItemTemplate>
</AutoCompleteBox>
<AutoCompleteBox
Classes="Bordered"
Items="{Binding States}"

View File

@ -12,6 +12,7 @@
<Panel>
<TextBox
Name="PART_TextBox"
VerticalAlignment="Center"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
Watermark="{TemplateBinding Watermark}" />
<Popup
@ -46,6 +47,7 @@
<Panel>
<TextBox
Name="PART_TextBox"
VerticalAlignment="Center"
Classes="Bordered"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
Watermark="{TemplateBinding Watermark}" />
@ -75,7 +77,15 @@
</ControlTemplate>
</Setter>
</Style>
<Style Selector="^.Large /template/ TextBox">
<Setter Property="TextBox.MinHeight" Value="{DynamicResource AutoCompleteBoxLargeHeight}" />
</Style>
<Style Selector="^.Small /template/ TextBox">
<Setter Property="TextBox.MinHeight" Value="{DynamicResource AutoCompleteBoxSmallHeight}" />
</Style>
</ControlTheme>
</ResourceDictionary>

View File

@ -6,4 +6,7 @@
<Thickness x:Key="AutoCompleteBoxPopupMargin">4</Thickness>
<CornerRadius x:Key="AutoCompleteBoxPopupCornerRadius">6</CornerRadius>
<CornerRadius x:Key="AutoCompleteBoxCornerRadius">3</CornerRadius>
<x:Double x:Key="AutoCompleteBoxDefaultHeight">30</x:Double>
<x:Double x:Key="AutoCompleteBoxSmallHeight">22</x:Double>
<x:Double x:Key="AutoCompleteBoxLargeHeight">38</x:Double>
</ResourceDictionary>

View File

@ -1,7 +1,4 @@
<ResourceDictionary
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=System.Runtime">
<ResourceDictionary xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<SolidColorBrush x:Key="TextBoxTextCaretBrush" Color="Black" />
<SolidColorBrush x:Key="TextBoxDefaultBorderBrush" Color="Transparent" />
@ -27,12 +24,12 @@
<SolidColorBrush x:Key="TextBoxBorderedPointeroverBackground" Color="Transparent" />
<SolidColorBrush x:Key="TextBoxBorderedPointeroverBorderBrush" Color="#0062D6" />
<sys:Double x:Key="TextBoxDefaultHeight">30</sys:Double>
<sys:Double x:Key="TextBoxSmallHeight">22</sys:Double>
<sys:Double x:Key="TextBoxLargeHeight">38</sys:Double>
<sys:Double x:Key="TextBoxWrapperDefaultHeight">32</sys:Double>
<sys:Double x:Key="TextBoxWrapperSmallHeight">24</sys:Double>
<sys:Double x:Key="TextBoxWrapperLargeHeight">40</sys:Double>
<x:Double x:Key="TextBoxDefaultHeight">30</x:Double>
<x:Double x:Key="TextBoxSmallHeight">22</x:Double>
<x:Double x:Key="TextBoxLargeHeight">38</x:Double>
<x:Double x:Key="TextBoxWrapperDefaultHeight">32</x:Double>
<x:Double x:Key="TextBoxWrapperSmallHeight">24</x:Double>
<x:Double x:Key="TextBoxWrapperLargeHeight">40</x:Double>
<CornerRadius x:Key="TextBoxDefaultCornerRadius">3</CornerRadius>