Plane.FormationCreator/Plane.FormationCreator/StylesOld/ComboBox.xaml
2017-02-27 02:06:48 +08:00

328 lines
24 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:c="http://metro.mahapps.com/winfx/xaml/controls">
<Style TargetType="{x:Type ComboBox}"
BasedOn="{StaticResource {x:Type ComboBox}}">
<Setter Property="Background"
Value="#252525" />
<Setter Property="BorderBrush"
Value="{StaticResource BorderBrushNormal}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ComboBox}">
<Grid>
<Grid.Resources>
<Style x:Key="comboToggleStyle"
TargetType="{x:Type ToggleButton}">
<Setter Property="Foreground"
Value="{DynamicResource TextBrush}" />
<Setter Property="Background"
Value="{DynamicResource TextBoxBackground}" />
<Setter Property="BorderBrush"
Value="{DynamicResource BorderBrushNormal}" />
<Setter Property="BorderThickness"
Value="1" />
<Setter Property="Padding"
Value="3" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ToggleButton}">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="MouseOverBorder">
<EasingDoubleKeyFrame KeyTime="0"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="PressedBorder">
<EasingDoubleKeyFrame KeyTime="0"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled" />
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="FocusRectangle">
<EasingDoubleKeyFrame KeyTime="0"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Background"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}" />
<Rectangle x:Name="DisabledVisualElement"
Fill="{DynamicResource WhiteBrush}"
IsHitTestVisible="false"
Opacity="0" />
<Border x:Name="MouseOverBorder"
Background="{DynamicResource TextBoxBackgroundSelected}"
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0" />
<Border x:Name="PressedBorder"
Background="{DynamicResource TextBoxBackgroundSelected}"
BorderThickness="{TemplateBinding BorderThickness}"
Opacity="0" />
<Rectangle x:Name="FocusRectangle"
Stroke="{DynamicResource BorderBrushHighlighted}"
Opacity="0" />
<Rectangle x:Name="FocusVisualElement"
IsHitTestVisible="false"
Margin="1"
Stroke="{DynamicResource HighlightBrush}"
StrokeThickness="1"
Visibility="Collapsed" />
<Grid Margin="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualHeight, Mode=OneWay}" />
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualHeight, Mode=OneWay}" />
</Grid.ColumnDefinitions>
<Button x:Name="PART_ClearText"
Grid.Column="1"
FontSize="16"
Style="{DynamicResource ChromelessButtonStyle}"
Foreground="{TemplateBinding Foreground}"
FontFamily="Marlett"
Content="r"
Visibility="{Binding RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}, Path=(c:TextBoxHelper.ClearTextButton), Converter={StaticResource BooleanToVisibilityConverter}}"
IsTabStop="False" />
<Rectangle x:Name="BtnArrowBackground"
Grid.Column="2"
Fill="Transparent"
StrokeThickness="0" />
<Path x:Name="BtnArrow"
Grid.Column="2"
IsHitTestVisible="false"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
Data="F1 M 301.14,-189.041L 311.57,-189.041L 306.355,-182.942L 301.14,-189.041 Z "
HorizontalAlignment="Center"
Height="4"
Stretch="Uniform"
Width="8"
Fill="{DynamicResource GrayBrush1}" />
</Grid>
</Grid>
<ControlTemplate.Triggers>
<Trigger SourceName="BtnArrowBackground"
Property="IsMouseOver"
Value="True">
<Setter TargetName="BtnArrowBackground"
Property="Fill"
Value="{DynamicResource GrayBrush2}" />
</Trigger>
<Trigger SourceName="FocusVisualElement"
Property="Visibility"
Value="Visible">
<Setter TargetName="BtnArrowBackground"
Property="Fill"
Value="{DynamicResource HighlightBrush}" />
</Trigger>
<Trigger SourceName="PART_ClearText"
Property="IsMouseOver"
Value="True">
<Setter TargetName="PART_ClearText"
Property="Background"
Value="{DynamicResource GrayBrush8}" />
<Setter TargetName="PART_ClearText"
Property="Foreground"
Value="{DynamicResource AccentColorBrush}" />
</Trigger>
<Trigger SourceName="PART_ClearText"
Property="IsPressed"
Value="True">
<Setter TargetName="PART_ClearText"
Property="Background"
Value="{DynamicResource BlackBrush}" />
<Setter TargetName="PART_ClearText"
Property="Foreground"
Value="{DynamicResource WhiteBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Grid.Resources>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal" />
<VisualState x:Name="MouseOver" />
<VisualState x:Name="Disabled">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="DisabledVisualElement">
<SplineDoubleKeyFrame KeyTime="00:00:00"
Value="0.45" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)"
Storyboard.TargetName="FocusRectangle">
<EasingDoubleKeyFrame KeyTime="0"
Value="1" />
</DoubleAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
<VisualState x:Name="FocusedDropDown">
<Storyboard>
<ObjectAnimationUsingKeyFrames Duration="00:00:00"
Storyboard.TargetProperty="(UIElement.Visibility)"
Storyboard.TargetName="PopupBorder">
<DiscreteObjectKeyFrame KeyTime="00:00:00">
<DiscreteObjectKeyFrame.Value>
<Visibility>Visible</Visibility>
</DiscreteObjectKeyFrame.Value>
</DiscreteObjectKeyFrame>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualHeight, Mode=OneWay}" />
<ColumnDefinition Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Grid}}, Path=ActualHeight, Mode=OneWay}" />
</Grid.ColumnDefinitions>
<ToggleButton x:Name="PART_DropDownToggle"
Grid.ColumnSpan="3"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
Margin="0"
Style="{DynamicResource comboToggleStyle}"
IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
VerticalAlignment="Stretch"
KeyboardNavigation.IsTabStop="False" />
<Border x:Name="EditableTextBoxBorder"
Visibility="Collapsed"
BorderBrush="Transparent"
BorderThickness="1,1,0,1"
Margin="0,0,-2,0"
Background="{TemplateBinding Background}">
<TextBox x:Name="PART_EditableTextBox"
HorizontalAlignment="Stretch"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
BorderThickness="0"
Background="{x:Null}"
Margin="0,0,0,-2"
c:TextBoxHelper.Watermark="{TemplateBinding c:TextBoxHelper.Watermark}"
Foreground="{TemplateBinding Foreground}"
Focusable="True"
IsReadOnly="{TemplateBinding IsReadOnly}"
FontFamily="{TemplateBinding FontFamily}"
FontSize="{TemplateBinding FontSize}" />
</Border>
<Grid x:Name="ContentSite"
Margin="7 0 0 0">
<ContentPresenter ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
Content="{TemplateBinding SelectionBoxItem}"
ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
IsHitTestVisible="false"
Margin="{TemplateBinding Padding}"
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}" />
</Grid>
</Grid>
<Rectangle x:Name="FocusRectangle"
Stroke="{DynamicResource BorderBrushSelected}"
Opacity="0" />
<Rectangle x:Name="DisabledVisualElement"
Fill="{DynamicResource DisabledWhiteBrush}"
IsHitTestVisible="false"
Opacity="0" />
<!-- AllowsTransparency="true" fixes the redraw problem under windows vista/7 with a selected non aero theme -->
<Popup x:Name="PART_Popup"
AllowsTransparency="True"
Focusable="False"
IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}"
Placement="Bottom">
<Grid MinWidth="{Binding ActualWidth, RelativeSource={RelativeSource TemplatedParent}}"
MaxHeight="{Binding MaxDropDownHeight, RelativeSource={RelativeSource TemplatedParent}}">
<Border x:Name="PopupBorder"
Effect="{DynamicResource DropShadowBrush}"
BorderThickness="{TemplateBinding BorderThickness}"
HorizontalAlignment="Stretch"
Height="Auto"
BorderBrush="{DynamicResource BorderBrushNormal}"
Background="{DynamicResource WhiteBrush}">
</Border>
<ScrollViewer x:Name="DropDownScrollViewer"
BorderThickness="0"
Margin="2"
Padding="1">
<ItemsPresenter x:Name="ItemsPresenter"
KeyboardNavigation.DirectionalNavigation="Contained" />
</ScrollViewer>
</Grid>
</Popup>
</Grid>
<ControlTemplate.Triggers>
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(c:TextBoxHelper.ClearTextButton)}"
Value="False">
<Setter TargetName="EditableTextBoxBorder"
Property="Grid.ColumnSpan"
Value="2" />
<Setter TargetName="ContentSite"
Property="Grid.ColumnSpan"
Value="2" />
</DataTrigger>
<Trigger Property="IsEditable"
Value="True">
<Setter Property="IsTabStop"
Value="false" />
<Setter TargetName="EditableTextBoxBorder"
Property="Visibility"
Value="Visible" />
<Setter TargetName="ContentSite"
Property="Visibility"
Value="Hidden" />
<Setter TargetName="PART_DropDownToggle"
Property="Focusable"
Value="False" />
<!-- #1037 : don't know why we set this to transparent ???
<Setter TargetName="PART_DropDownToggle"
Property="Background"
Value="Transparent" /> -->
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>