mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-03-02 15:50:49 +08:00
Update AutoCompleteBox style to use ClassHelper for Bordered TextBox (#747)
* feat: update AutoCompleteBox style to use ClassHelper for Bordered TextBox. * Update src/Semi.Avalonia/Controls/AutoCompleteBox.axaml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * feat: unitize Bordered style selectors. --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
<ResourceDictionary
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:iri="https://irihi.tech/shared">
|
||||
<Design.PreviewWith>
|
||||
<StackPanel Margin="20" Spacing="20">
|
||||
<TextBox Text="Hello" />
|
||||
@@ -56,45 +57,13 @@
|
||||
</Setter>
|
||||
|
||||
<Style Selector="^.Bordered">
|
||||
<Setter Property="Template">
|
||||
<ControlTemplate TargetType="AutoCompleteBox">
|
||||
<Panel>
|
||||
<TextBox
|
||||
Name="PART_TextBox"
|
||||
VerticalAlignment="Stretch"
|
||||
MinHeight="0"
|
||||
Classes="Bordered"
|
||||
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}"
|
||||
PlaceholderForeground="{TemplateBinding PlaceholderForeground}"
|
||||
PlaceholderText="{TemplateBinding PlaceholderText}" />
|
||||
<Popup
|
||||
Name="PART_Popup"
|
||||
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
||||
InheritsTransform="True"
|
||||
IsLightDismissEnabled="True"
|
||||
PlacementTarget="{TemplateBinding}">
|
||||
<Border
|
||||
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
|
||||
Margin="{DynamicResource AutoCompleteBoxPopupMargin}"
|
||||
Padding="{DynamicResource AutoCompleteBoxPopupPadding}"
|
||||
HorizontalAlignment="Stretch"
|
||||
Background="{DynamicResource AutoCompleteBoxPopupBackground}"
|
||||
BorderBrush="{DynamicResource AutoCompleteBoxPopupBorderBrush}"
|
||||
BorderThickness="{DynamicResource AutoCompleteBoxPopupBorderThickness}"
|
||||
BoxShadow="{DynamicResource AutoCompleteBoxPopupBoxShadow}"
|
||||
CornerRadius="{DynamicResource AutoCompleteBoxPopupCornerRadius}">
|
||||
<ListBox
|
||||
Name="PART_SelectingItemsControl"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
ItemTemplate="{TemplateBinding ItemTemplate}"
|
||||
ScrollViewer.HorizontalScrollBarVisibility="Auto"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Auto"
|
||||
ScrollViewer.IsScrollChainingEnabled="False" />
|
||||
</Border>
|
||||
</Popup>
|
||||
</Panel>
|
||||
</ControlTemplate>
|
||||
</Setter>
|
||||
<Style Selector="^ /template/ TextBox#PART_TextBox">
|
||||
<Setter Property="MinHeight" Value="0" />
|
||||
<Setter Property="iri:ClassHelper.Classes" Value="Bordered" />
|
||||
</Style>
|
||||
<Style Selector="^ /template/ ListBox#PART_SelectingItemsControl">
|
||||
<Setter Property="ScrollViewer.IsScrollChainingEnabled" Value="False" />
|
||||
</Style>
|
||||
</Style>
|
||||
<Style Selector="^.Large">
|
||||
<Setter Property="MinHeight" Value="{DynamicResource AutoCompleteBoxLargeHeight}" />
|
||||
|
||||
Reference in New Issue
Block a user