Browse Source

Add Fluent AutoCompleteBox Style

pull/4033/head
Max Katz 6 years ago
committed by Dan Walmsley
parent
commit
9c67a01d62
  1. 65
      src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml

65
src/Avalonia.Themes.Fluent/AutoCompleteBox.xaml

@ -1,37 +1,64 @@
<Styles xmlns="https://github.com/avaloniaui"> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Design.PreviewWith>
<Border Padding="20">
<AutoCompleteBox Width="200">
<AutoCompleteBox.Items>
Alabama
Alaska
Arizona
Arkansas
California
Colorado
Connecticut
Delaware
</AutoCompleteBox.Items>
</AutoCompleteBox>
</Border>
</Design.PreviewWith>
<Style Selector="AutoCompleteBox"> <Style Selector="AutoCompleteBox">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <Setter Property="VerticalAlignment" Value="Top" />
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Setter Property="Foreground" Value="{DynamicResource TextControlForeground}" />
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> <Setter Property="Background" Value="{DynamicResource TextControlBackground}" />
<Setter Property="Padding" Value="4"/> <Setter Property="BorderBrush" Value="{DynamicResource TextControlBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource TextControlBorderThemeThickness}" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{DynamicResource ControlContentThemeFontSize}" />
<Setter Property="Template"> <Setter Property="Template">
<ControlTemplate> <ControlTemplate>
<Panel> <Grid Name="PART_LayoutRoot">
<TextBox Name="PART_TextBox" <TextBox Name="PART_TextBox"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Padding="{TemplateBinding Padding}"
Watermark="{TemplateBinding Watermark}" Watermark="{TemplateBinding Watermark}"
Width="{TemplateBinding Width}"
Foreground="{TemplateBinding Foreground}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
FontSize="{TemplateBinding FontSize}"
FontFamily="{TemplateBinding FontFamily}"
FontWeight="{TemplateBinding FontWeight}"
Margin="0"
DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" /> DataValidationErrors.Errors="{TemplateBinding (DataValidationErrors.Errors)}" />
<Popup Name="PART_Popup" <Popup Name="PART_Popup"
MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}" MinWidth="{Binding Bounds.Width, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{TemplateBinding MaxDropDownHeight}" MaxHeight="{TemplateBinding MaxDropDownHeight}"
PlacementTarget="{TemplateBinding}" StaysOpen="False"
StaysOpen="False"> PlacementTarget="{TemplateBinding}">
<Border BorderBrush="{DynamicResource ThemeBorderMidBrush}" <Border Name="PART_SuggestionsContainer"
BorderThickness="1"> Padding="{DynamicResource AutoCompleteListMargin}"
BorderThickness="{DynamicResource AutoCompleteListBorderThemeThickness}"
BorderBrush="{DynamicResource AutoCompleteBoxSuggestionsListBorderBrush}"
Background="{DynamicResource AutoCompleteBoxSuggestionsListBackground}"
CornerRadius="{DynamicResource OverlayCornerRadius}">
<ListBox Name="PART_SelectingItemsControl" <ListBox Name="PART_SelectingItemsControl"
BorderThickness="0" BorderThickness="0"
Background="{TemplateBinding Background}"
Foreground="{TemplateBinding Foreground}"
ItemTemplate="{TemplateBinding ItemTemplate}" ItemTemplate="{TemplateBinding ItemTemplate}"
ScrollViewer.HorizontalScrollBarVisibility="Auto" MaxHeight="{DynamicResource AutoCompleteListMaxHeight}"
ScrollViewer.VerticalScrollBarVisibility="Auto" /> Margin="{DynamicResource AutoCompleteListPadding}" />
</Border> </Border>
</Popup> </Popup>
</Panel> </Grid>
</ControlTemplate> </ControlTemplate>
</Setter> </Setter>
</Style> </Style>

Loading…
Cancel
Save