161 lines
9.1 KiB
XML
161 lines
9.1 KiB
XML
<ResourceDictionary
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
|
|
xmlns:conv="clr-namespace:BeWo.Styles.Converters">
|
|
<ResourceDictionary.MergedDictionaries>
|
|
<ResourceDictionary Source="..\DataTemplates\ControlTemplates.xaml" />
|
|
<ResourceDictionary Source="..\ControlStyles\ToggleButtonStyles.xaml" />
|
|
</ResourceDictionary.MergedDictionaries>
|
|
|
|
|
|
<!-- ComboBox -->
|
|
<Style x:Key="BaseComboBox" TargetType="ComboBox">
|
|
<Setter Property="Margin" Value="3" />
|
|
<Setter Property="Height" Value="23" />
|
|
<Setter Property="FocusVisualStyle" Value="{DynamicResource ComboBoxFocusVisual}" />
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
|
|
<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
|
|
<Setter Property="BorderBrush" Value="{DynamicResource TextBoxBorderBrush}" />
|
|
<Setter Property="BorderThickness" Value="1" />
|
|
<Setter Property="Padding" Value="1" />
|
|
<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
|
|
<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="True" />
|
|
<Setter Property="VerticalContentAlignment" Value="Center" />
|
|
</Style>
|
|
<Style
|
|
x:Key="PrimaryComboBox"
|
|
BasedOn="{StaticResource BaseComboBox}"
|
|
TargetType="ComboBox">
|
|
<Setter Property="Template">
|
|
<Setter.Value>
|
|
<ControlTemplate TargetType="{x:Type ComboBox}">
|
|
<Grid SnapsToDevicePixels="true">
|
|
<Border
|
|
x:Name="Bd"
|
|
MaxWidth="{TemplateBinding MaxWidth}"
|
|
Padding="1"
|
|
Background="{TemplateBinding Background}"
|
|
BorderBrush="{TemplateBinding BorderBrush}"
|
|
BorderThickness="{TemplateBinding BorderThickness}">
|
|
<Grid Grid.IsSharedSizeScope="true">
|
|
<Grid.ColumnDefinitions>
|
|
<ColumnDefinition Width="1" />
|
|
<ColumnDefinition Width="*" />
|
|
<ColumnDefinition Width="Auto" SharedSizeGroup="ComboBoxButton" />
|
|
</Grid.ColumnDefinitions>
|
|
<Border
|
|
x:Name="SelectedItemBorder"
|
|
Grid.ColumnSpan="2"
|
|
Margin="2,1,20,1">
|
|
<ContentPresenter
|
|
Margin="3,0"
|
|
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
|
|
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
|
Content="{TemplateBinding SelectionBoxItem}"
|
|
ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
|
|
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
|
|
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
</Border>
|
|
<ToggleButton
|
|
Grid.ColumnSpan="3"
|
|
IsChecked="{Binding Path=IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
|
|
Style="{StaticResource ComboBoxTransparentButtonStyle}" />
|
|
</Grid>
|
|
</Border>
|
|
<Popup
|
|
x:Name="PART_Popup"
|
|
AllowsTransparency="true"
|
|
Focusable="false"
|
|
IsOpen="{Binding Path=IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
|
|
Placement="Bottom"
|
|
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
|
|
<Microsoft_Windows_Themes:SystemDropShadowChrome
|
|
x:Name="Shdw"
|
|
MinWidth="{TemplateBinding ActualWidth}"
|
|
MaxHeight="{TemplateBinding MaxDropDownHeight}"
|
|
Color="Transparent">
|
|
<Border
|
|
x:Name="DropDownBorder"
|
|
Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
|
|
BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
|
|
BorderThickness="1">
|
|
<ScrollViewer>
|
|
<ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
|
|
</ScrollViewer>
|
|
</Border>
|
|
</Microsoft_Windows_Themes:SystemDropShadowChrome>
|
|
</Popup>
|
|
</Grid>
|
|
<ControlTemplate.Triggers>
|
|
<MultiTrigger>
|
|
<MultiTrigger.Conditions>
|
|
<Condition Property="IsSelectionBoxHighlighted" Value="true" />
|
|
<Condition Property="IsDropDownOpen" Value="false" />
|
|
</MultiTrigger.Conditions>
|
|
<Setter Property="Foreground" Value="#FF000000" />
|
|
</MultiTrigger>
|
|
<Trigger Property="IsSelectionBoxHighlighted" Value="true">
|
|
<Setter TargetName="SelectedItemBorder" Property="Background" Value="{DynamicResource ControlSelectedBackgroundBrush}" />
|
|
</Trigger>
|
|
<Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
|
|
<Setter TargetName="Shdw" Property="Margin" Value="0,0,5,5" />
|
|
<Setter TargetName="Shdw" Property="Color" Value="#71000000" />
|
|
</Trigger>
|
|
<Trigger Property="HasItems" Value="false">
|
|
<Setter TargetName="DropDownBorder" Property="MinHeight" Value="95" />
|
|
</Trigger>
|
|
<Trigger Property="IsEnabled" Value="false">
|
|
<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
|
|
<Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" />
|
|
</Trigger>
|
|
<Trigger Property="IsGrouping" Value="true">
|
|
<Setter Property="ScrollViewer.CanContentScroll" Value="false" />
|
|
</Trigger>
|
|
</ControlTemplate.Triggers>
|
|
</ControlTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
<Style.Triggers>
|
|
<Trigger Property="IsEditable" Value="true">
|
|
<Setter Property="IsTabStop" Value="false" />
|
|
<Setter Property="Padding" Value="0,1" />
|
|
<Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
|
|
</Trigger>
|
|
</Style.Triggers>
|
|
</Style>
|
|
|
|
<Style
|
|
x:Key="NoWrapComboBox"
|
|
BasedOn="{StaticResource PrimaryComboBox}"
|
|
TargetType="ComboBox">
|
|
<Setter Property="ItemTemplate">
|
|
<Setter.Value>
|
|
<DataTemplate>
|
|
<TextBlock Text="{Binding Path=.}" TextWrapping="NoWrap" />
|
|
</DataTemplate>
|
|
</Setter.Value>
|
|
</Setter>
|
|
</Style>
|
|
|
|
<conv:EnumTranslationConverter x:Key="EnumTranslationConverter" />
|
|
<DataTemplate x:Key="ListItemView">
|
|
<TextBlock
|
|
x:Name="textblock"
|
|
MaxWidth="362"
|
|
ScrollViewer.HorizontalScrollBarVisibility="Disabled"
|
|
Text="{Binding Path=., Converter={StaticResource EnumTranslationConverter}}"
|
|
TextTrimming="CharacterEllipsis"
|
|
TextWrapping="NoWrap"
|
|
ToolTip="{Binding Path=Text, RelativeSource={RelativeSource Self}}" />
|
|
</DataTemplate>
|
|
<Style
|
|
x:Key="EnumTranslationComboBox"
|
|
BasedOn="{StaticResource PrimaryComboBox}"
|
|
TargetType="ComboBox">
|
|
<Setter Property="ItemTemplate" Value="{StaticResource ListItemView}" />
|
|
<Setter Property="HorizontalAlignment" Value="Stretch" />
|
|
<Setter Property="MaxWidth" Value="400" />
|
|
</Style>
|
|
</ResourceDictionary> |