97 lines
6.4 KiB
Plaintext
97 lines
6.4 KiB
Plaintext
|
|
<ResourceDictionary
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:assists="clr-namespace:NeoUI.Assists"
|
||
|
|
xmlns:converters="clr-namespace:NeoUI.Converters"
|
||
|
|
xmlns:local="clr-namespace:NeoUI.Controls"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||
|
|
|
||
|
|
<Style TargetType="{x:Type local:AutoComplete}">
|
||
|
|
<Setter Property="assists:InputAssist.Placeholder" Value="请输入..." />
|
||
|
|
<Setter Property="assists:InputAssist.Clearable" Value="True" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="{x:Type local:AutoComplete}">
|
||
|
|
<Grid>
|
||
|
|
<TextBox
|
||
|
|
Text="{Binding Text, RelativeSource={RelativeSource TemplatedParent}, UpdateSourceTrigger=PropertyChanged}"
|
||
|
|
VerticalContentAlignment="Center"
|
||
|
|
assists:InputAssist.Clearable="{TemplateBinding assists:InputAssist.Clearable}"
|
||
|
|
assists:InputAssist.Placeholder="{TemplateBinding assists:InputAssist.Placeholder}"
|
||
|
|
x:Name="PART_TextBox" />
|
||
|
|
<Popup
|
||
|
|
AllowsTransparency="True"
|
||
|
|
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
|
MinWidth="{Binding ActualWidth, ElementName=PART_TextBox}"
|
||
|
|
PlacementTarget="{Binding ElementName=PART_TextBox}"
|
||
|
|
PopupAnimation="Slide"
|
||
|
|
StaysOpen="False"
|
||
|
|
x:Name="PART_Popup">
|
||
|
|
<Border
|
||
|
|
Background="{DynamicResource BackgroundFloatingBrush}"
|
||
|
|
BorderBrush="{DynamicResource BorderNormalBrush}"
|
||
|
|
BorderThickness="1"
|
||
|
|
CornerRadius="6"
|
||
|
|
Effect="{DynamicResource PopupShadow}"
|
||
|
|
Margin="0,8,0,0"
|
||
|
|
MinHeight="30">
|
||
|
|
<!--<Border.Effect>
|
||
|
|
<DropShadowEffect
|
||
|
|
BlurRadius="10"
|
||
|
|
Opacity="0.1"
|
||
|
|
ShadowDepth="0"
|
||
|
|
Color="Black" />
|
||
|
|
</Border.Effect>-->
|
||
|
|
<ListBox
|
||
|
|
BorderThickness="0"
|
||
|
|
ItemsSource="{Binding ItemsSource, RelativeSource={RelativeSource TemplatedParent}}"
|
||
|
|
x:Name="PART_ListBox">
|
||
|
|
<ListBox.ItemContainerStyle>
|
||
|
|
<Style TargetType="ListBoxItem">
|
||
|
|
<Setter Property="Padding" Value="12,5,12,5" />
|
||
|
|
<Setter Property="Template">
|
||
|
|
<Setter.Value>
|
||
|
|
<ControlTemplate TargetType="ListBoxItem">
|
||
|
|
<Border
|
||
|
|
Background="{TemplateBinding Background}"
|
||
|
|
Padding="{TemplateBinding Padding}"
|
||
|
|
SnapsToDevicePixels="true"
|
||
|
|
x:Name="Bd">
|
||
|
|
<ContentPresenter
|
||
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
||
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
||
|
|
</Border>
|
||
|
|
<ControlTemplate.Triggers>
|
||
|
|
<Trigger Property="IsMouseOver" Value="true">
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundHoverBrush}" />
|
||
|
|
</Trigger>
|
||
|
|
<Trigger Property="IsSelected" Value="true">
|
||
|
|
<Setter Property="Background" TargetName="Bd" Value="{DynamicResource ControlBackgroundSelectedBrush}" />
|
||
|
|
</Trigger>
|
||
|
|
</ControlTemplate.Triggers>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
</ListBox.ItemContainerStyle>
|
||
|
|
<ListBox.ItemTemplate>
|
||
|
|
<DataTemplate>
|
||
|
|
<ContentPresenter>
|
||
|
|
<ContentPresenter.Content>
|
||
|
|
<MultiBinding Converter="{x:Static converters:StringMatchConverter.Instance}">
|
||
|
|
<Binding />
|
||
|
|
<Binding Path="Text" RelativeSource="{RelativeSource AncestorType=local:AutoComplete}" />
|
||
|
|
</MultiBinding>
|
||
|
|
</ContentPresenter.Content>
|
||
|
|
</ContentPresenter>
|
||
|
|
</DataTemplate>
|
||
|
|
</ListBox.ItemTemplate>
|
||
|
|
</ListBox>
|
||
|
|
</Border>
|
||
|
|
</Popup>
|
||
|
|
</Grid>
|
||
|
|
</ControlTemplate>
|
||
|
|
</Setter.Value>
|
||
|
|
</Setter>
|
||
|
|
</Style>
|
||
|
|
</ResourceDictionary>
|