291 lines
19 KiB
XML
291 lines
19 KiB
XML
<ResourceDictionary
|
|
x:Class="WPFDark.Controls.BiaFilteringComboBoxEventHandler"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:controls="clr-namespace:WPFDark.Controls"
|
|
xmlns:wpf="clr-namespace:WPFDark"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
|
<Style TargetType="{x:Type ToggleButton}" x:Key="DropDownToggleButtonStyle">
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForegroundBrushKey}" />
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
|
|
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
<ContentPresenter
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
Margin="{TemplateBinding Padding}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Style.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonActiveBorderBrushKey}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonActiveForegroundBrushKey}" />
|
|
</Trigger>
|
|
<Trigger Property="IsPressed" Value="True">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonPressedBorderBrushKey}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonPressedForegroundBrushKey}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonInactiveBorderBrushKey}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource ButtonInactiveForegroundBrushKey}" />
|
|
</Trigger>
|
|
<Trigger Property="IsChecked" Value="True">
|
|
<Setter Property="BorderBrush" Value="{DynamicResource ButtonInactiveBorderBrushKey}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource AccentForegroundBrushKey}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style TargetType="{x:Type controls:BiaFilteringComboBox}">
|
|
<Style.Triggers>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="Foreground" Value="{DynamicResource InactiveForegroundBrushKey}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
|
|
<Setter Property="Background" Value="{DynamicResource TextBoxBackgroundBrushKey}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrushKey}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource TextBoxForegroundBrushKey}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource {x:Static SystemParameters.FocusVisualStyleKey}}" />
|
|
<Setter Property="Height" Value="{x:Static wpf:Boxes.BasicOneLineHeight}" />
|
|
|
|
<Setter Property="ItemTemplate">
|
|
<Setter.Value>
|
|
<DataTemplate>
|
|
<controls:BiaHighlightTextBlock Text="{Binding Mode=OneWay}" Words="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaFilteringComboBox}}, Mode=OneWay, Path=FilterWords}" />
|
|
</DataTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Setter Property="ItemContainerStyle">
|
|
<Setter.Value>
|
|
<Style TargetType="{x:Type ComboBoxItem}">
|
|
<Setter Property="SnapsToDevicePixels" Value="True" />
|
|
<Setter Property="OverridesDefaultStyle" Value="True" />
|
|
<Setter Property="Background" Value="Transparent" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
|
|
<Setter Property="Focusable" Value="False" />
|
|
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ComboBoxItem}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
Padding="1"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
<ContentPresenter Margin="4,0,0,0" />
|
|
</Border>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Background" Value="{DynamicResource SubmenuItemBackgroundHighlighted}" />
|
|
</Trigger>
|
|
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsSelected" Value="True" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border}" />
|
|
</MultiTrigger>
|
|
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsSelected" Value="True" />
|
|
<Condition Property="IsMouseOver" Value="True" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Background" Value="{DynamicResource Item.SelectedActive.Background.IsMouseOver}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource Item.SelectedActive.Border.IsMouseOver}" />
|
|
</MultiTrigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Setter Property="Validation.ErrorTemplate">
|
|
<Setter.Value>
|
|
<ControlTemplate />
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
|
<Grid SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}"
|
|
CornerRadius="{x:Static wpf:Boxes.BasicCornerRadius}"
|
|
x:Name="border">
|
|
<Grid Margin="-1">
|
|
<ToggleButton
|
|
ClickMode="Press"
|
|
Focusable="False"
|
|
Foreground="{DynamicResource InactiveForegroundBrushKey}"
|
|
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
IsTabStop="False"
|
|
OverridesDefaultStyle="True"
|
|
Style="{StaticResource DropDownToggleButtonStyle}"
|
|
x:Name="toggleButton">
|
|
<ToggleButton.Template>
|
|
<ControlTemplate TargetType="{x:Type ToggleButton}">
|
|
<Border Background="Transparent">
|
|
<Path
|
|
Data="M 0.0,0.0 L 3.5,4.0 7.0,0.0 z"
|
|
Fill="{TemplateBinding Foreground}"
|
|
HorizontalAlignment="Right"
|
|
VerticalAlignment="Center"
|
|
Width="{x:Static SystemParameters.VerticalScrollBarWidth}" />
|
|
</Border>
|
|
</ControlTemplate>
|
|
</ToggleButton.Template>
|
|
</ToggleButton>
|
|
|
|
<ContentPresenter
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
|
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
|
Grid.Column="0"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
IsHitTestVisible="False"
|
|
Margin="4.5,2.25,26,2.25"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
|
|
<ContentPresenter.Resources>
|
|
<Style TargetType="{x:Type TextBlock}">
|
|
<Setter Property="TextTrimming" Value="CharacterEllipsis" />
|
|
</Style>
|
|
</ContentPresenter.Resources>
|
|
</ContentPresenter>
|
|
</Grid>
|
|
</Border>
|
|
|
|
<Popup
|
|
AllowsTransparency="True"
|
|
Closed="Popup_OnClosed"
|
|
FocusVisualStyle="{x:Null}"
|
|
Focusable="False"
|
|
HorizontalOffset="-2"
|
|
IsOpen="{TemplateBinding IsDropDownOpen}"
|
|
Loaded="Popup_OnLoaded"
|
|
MinWidth="{TemplateBinding ActualWidth}"
|
|
Opened="Popup_OnOpened"
|
|
Placement="Bottom"
|
|
PopupAnimation="None"
|
|
Unloaded="Popup_OnUnloaded"
|
|
VerticalOffset="1.0"
|
|
x:Name="PART_Popup">
|
|
<controls:BiaClippingBorder
|
|
Background="{DynamicResource SubmenuItemBackground}"
|
|
BorderBrush="{DynamicResource Item.SelectedActive.Border}"
|
|
BorderThickness="1"
|
|
Margin="0,0,3,3"
|
|
MaxHeight="414"
|
|
SnapsToDevicePixels="True"
|
|
x:Name="dropdown">
|
|
<controls:BiaClippingBorder.Effect>
|
|
<DropShadowEffect Color="Black" ShadowDepth="2.0" />
|
|
</controls:BiaClippingBorder.Effect>
|
|
|
|
<DockPanel>
|
|
<TextBox
|
|
BorderThickness="0,0,0,1"
|
|
DockPanel.Dock="Top"
|
|
PreviewKeyDown="WordTextBox_OnKeyDown"
|
|
Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaFilteringComboBox}}, Path=FilterWords, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
|
x:Name="WordTextBox">
|
|
<TextBox.Template>
|
|
<ControlTemplate TargetType="{x:Type TextBox}">
|
|
<Border
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="0,0,0,1"
|
|
CornerRadius="0"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}">
|
|
<DockPanel>
|
|
<Path
|
|
Data="M 6.332031 2 C 8.726562 2 10.667969 3.941406 10.667969 6.332031 C 10.667969 7.40625 10.273438 8.394531 9.625 9.152344 L 9.808594 9.332031 L 10.332031 9.332031 L 13.667969 12.667969 L 12.667969 13.667969 L 9.332031 10.332031 L 9.332031 9.808594 L 9.152344 9.625 C 8.394531 10.273438 7.40625 10.667969 6.332031 10.667969 C 3.941406 10.667969 2 8.726562 2 6.332031 C 2 3.941406 3.941406 2 6.332031 2 M 6.332031 3.332031 C 4.667969 3.332031 3.332031 4.667969 3.332031 6.332031 C 3.332031 8 4.667969 9.332031 6.332031 9.332031 C 8 9.332031 9.332031 8 9.332031 6.332031 C 9.332031 4.667969 8 3.332031 6.332031 3.332031 Z M 6.332031 3.332031 "
|
|
DockPanel.Dock="Left"
|
|
Fill="{Binding RelativeSource={RelativeSource AncestorType={x:Type controls:BiaFilteringComboBox}}, Path=Foreground}"
|
|
Height="16"
|
|
Margin="4,2,2,0"
|
|
VerticalAlignment="Center"
|
|
Width="16" />
|
|
|
|
<controls:BiaIconButton
|
|
Click="ClearButton_OnClick"
|
|
Content="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z"
|
|
CornerRadius="0.0"
|
|
DockPanel.Dock="Right"
|
|
Loaded="ClearButton_OnLoaded"
|
|
Tag="{Binding ElementName=WordTextBox}"
|
|
VerticalAlignment="Stretch" />
|
|
|
|
<ScrollViewer
|
|
Background="Transparent"
|
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
HorizontalScrollBarVisibility="{TemplateBinding HorizontalScrollBarVisibility}"
|
|
Margin="{TemplateBinding Padding}"
|
|
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
VerticalScrollBarVisibility="{TemplateBinding VerticalScrollBarVisibility}"
|
|
x:Name="PART_ContentHost" />
|
|
</DockPanel>
|
|
</Border>
|
|
</ControlTemplate>
|
|
</TextBox.Template>
|
|
</TextBox>
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Auto">
|
|
<ItemsPresenter />
|
|
</ScrollViewer>
|
|
</DockPanel>
|
|
</controls:BiaClippingBorder>
|
|
</Popup>
|
|
</Grid>
|
|
|
|
<ControlTemplate.Triggers>
|
|
<Trigger Property="HasItems" Value="False">
|
|
<Setter Property="MinHeight" TargetName="dropdown" Value="100" />
|
|
</Trigger>
|
|
<Trigger Property="IsGrouping" Value="True">
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="False" />
|
|
</Trigger>
|
|
<Trigger Property="IsMouseOver" Value="True">
|
|
<Setter Property="Foreground" TargetName="toggleButton" Value="{DynamicResource AccentBrushKey}" />
|
|
<Setter Property="BorderBrush" TargetName="toggleButton" Value="{DynamicResource AccentBrushKey}" />
|
|
<Setter Property="Background" TargetName="toggleButton" Value="{DynamicResource BackgroundBrushKey}" />
|
|
<Setter Property="Background" TargetName="border" Value="{DynamicResource ActiveBackgroundBrushKey}" />
|
|
</Trigger>
|
|
<Trigger Property="IsOpen" SourceName="PART_Popup" Value="True">
|
|
<Setter Property="Background" TargetName="toggleButton" Value="{DynamicResource AccentBrushKey}" />
|
|
<Setter Property="Foreground" TargetName="toggleButton" Value="{DynamicResource AccentForegroundBrushKey}" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="False">
|
|
<Setter Property="BorderBrush" TargetName="border" Value="{DynamicResource InactiveBorderBrushKey}" />
|
|
<Setter Property="Background" TargetName="border" Value="{DynamicResource InactiveBackgroundBrushKey}" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
|
|
<Setter Property="ItemsPanel">
|
|
<Setter.Value>
|
|
<ItemsPanelTemplate>
|
|
<VirtualizingStackPanel KeyboardNavigation.DirectionalNavigation="Contained" />
|
|
</ItemsPanelTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
</ResourceDictionary> |