123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:hc="clr-namespace:HandyControl.Controls">
- <Style x:Key="AutoCompleteTextBoxItemBaseStyle" TargetType="ComboBoxItem">
- <Setter Property="Padding" Value="{StaticResource DefaultControlPadding}"/>
- <Setter Property="SnapsToDevicePixels" Value="True"/>
- <Setter Property="Background" Value="Transparent"/>
- <Setter Property="BorderBrush" Value="Transparent"/>
- <Setter Property="BorderThickness" Value="0"/>
- <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
- <Setter Property="Focusable" Value="False"/>
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="ComboBoxItem">
- <Border x:Name="Bd" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" SnapsToDevicePixels="true">
- <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
- </Border>
- <ControlTemplate.Triggers>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsSelected" Value="False"/>
- <Condition Property="IsMouseOver" Value="True"/>
- </MultiTrigger.Conditions>
- <Setter Property="Background" TargetName="Bd" Value="{DynamicResource SecondaryRegionBrush}"/>
- </MultiTrigger>
- <Trigger Property="IsSelected" Value="True">
- <Setter Property="Background" TargetName="Bd" Value="{DynamicResource PrimaryBrush}"/>
- <Setter Property="Foreground" Value="White"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <Style x:Key="AutoCompleteTextBoxBaseStyle" TargetType="hc:AutoCompleteTextBox">
- <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
- <Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
- <Setter Property="hc:BorderElement.CornerRadius" Value="{StaticResource DefaultCornerRadius}"/>
- <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
- <Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
- <Setter Property="BorderThickness" Value="1"/>
- <Setter Property="CaretBrush" Value="{DynamicResource PrimaryTextBrush}"/>
- <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
- <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
- <Setter Property="MinHeight" Value="{StaticResource DefaultControlHeight}"/>
- <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
- <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
- <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
- <Setter Property="Padding" Value="{StaticResource DefaultInputPadding}"/>
- <Setter Property="VerticalContentAlignment" Value="Center"/>
- <Setter Property="Validation.ErrorTemplate" Value="{x:Null}"/>
- <Setter Property="ItemContainerStyle" Value="{StaticResource AutoCompleteTextBoxItemBaseStyle}"/>
- <Setter Property="IsTabStop" Value="false"/>
- <Setter Property="hc:Empty.ShowEmpty" Value="True"/>
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="hc:AutoCompleteTextBox">
- <hc:SimplePanel>
- <Border CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" SnapsToDevicePixels="true">
- <TextBox x:Name="PART_SearchTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" CaretBrush="{TemplateBinding CaretBrush}" Padding="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}"/>
- </Border>
- <Popup x:Name="PART_Popup" AllowsTransparency="true" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" PopupAnimation="{StaticResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}" Placement="Bottom">
- <Border BorderThickness="0,1,0,0" Effect="{StaticResource EffectShadow2}" Margin="8,0,8,8" CornerRadius="{Binding Path=(hc:BorderElement.CornerRadius),RelativeSource={RelativeSource TemplatedParent}}" x:Name="dropDownBorder" MinWidth="{Binding ActualWidth, ElementName=toggleButton}" MaxHeight="{TemplateBinding MaxDropDownHeight}" BorderBrush="{DynamicResource BorderBrush}" Background="{DynamicResource RegionBrush}">
- <hc:ToggleBlock IsChecked="{Binding HasItems,RelativeSource={RelativeSource TemplatedParent},Mode=OneWay}" VerticalContentAlignment="Stretch" HorizontalContentAlignment="Stretch">
- <hc:ToggleBlock.CheckedContent>
- <ScrollViewer Margin="0,4">
- <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
- </ScrollViewer>
- </hc:ToggleBlock.CheckedContent>
- <hc:ToggleBlock.UnCheckedContent>
- <hc:Empty/>
- </hc:ToggleBlock.UnCheckedContent>
- </hc:ToggleBlock>
- </Border>
- </Popup>
- </hc:SimplePanel>
- <ControlTemplate.Triggers>
- <Trigger Property="HasItems" Value="false">
- <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
- </Trigger>
- <Trigger Property="hc:DropDownElement.ConsistentWidth" Value="True">
- <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}"/>
- <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualWidth, ElementName=PART_SearchTextBox}"/>
- </Trigger>
- <Trigger Property="hc:DropDownElement.AutoWidth" Value="True">
- <Setter Property="MaxWidth" TargetName="dropDownBorder" Value="{x:Static system:Double.MaxValue}" />
- <Setter Property="MinWidth" TargetName="dropDownBorder" Value="{Binding ActualHeight, ElementName=PART_SearchTextBox}" />
- </Trigger>
- <Trigger Property="IsMouseOver" Value="true" SourceName="PART_SearchTextBox">
- <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
- </Trigger>
- <MultiTrigger>
- <MultiTrigger.Conditions>
- <Condition Property="IsMouseOver" Value="true"/>
- <Condition Property="IsFocused" Value="false" SourceName="PART_SearchTextBox"/>
- </MultiTrigger.Conditions>
- <Setter Property="BorderBrush" Value="{DynamicResource SecondaryBorderBrush}"/>
- </MultiTrigger>
- <Trigger Property="IsFocused" Value="True" SourceName="PART_SearchTextBox">
- <Setter Property="BorderBrush" Value="{DynamicResource PrimaryBrush}"/>
- </Trigger>
- <Trigger Property="IsEnabled" Value="false">
- <Setter Property="Opacity" Value="0.4"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- </ResourceDictionary>
|