| 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
| 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
| 3 | xmlns:local="clr-namespace:UI.Controls.Select" xmlns:base="clr-namespace:UI.Controls.Base" xmlns:sys="clr-namespace:System;assembly=mscorlib"> |
| 4 | |
| 5 | |
| 6 | <Style TargetType="{x:Type local:Select}"> |
| 7 | <Setter Property="SnapsToDevicePixels" |
| 8 | Value="true" /> |
| 9 | <Setter Property="Padding" Value="18,10"/> |
| 10 | <Setter Property="Background" Value="{DynamicResource StandardBackgroundBrush}"/> |
| 11 | <Setter Property="FocusVisualStyle" Value="{x:Null}"/> |
| 12 | <Setter Property="Template"> |
| 13 | <Setter.Value> |
| 14 | <ControlTemplate TargetType="{x:Type local:Select}"> |
| 15 | <Border HorizontalAlignment="Left" > |
| 16 | |
| 17 | <Grid > |
| 18 | |
| 19 | <Border Background="{TemplateBinding Background}" Panel.ZIndex="-1" Width="{Binding ElementName=Main,Path=ActualWidth}" Height="{Binding ElementName=Main,Path=ActualHeight}" CornerRadius="{Binding ElementName=Main,Path=CornerRadius}" Padding="{TemplateBinding Padding}"> |
| 20 | <Border.Effect> |
| 21 | <DropShadowEffect Color="#d8d2d2" BlurRadius="1" Direction="300" ShadowDepth="4" Opacity="0.1" RenderingBias="Performance" ></DropShadowEffect> |
| 22 | </Border.Effect> |
| 23 | |
| 24 | </Border> |
| 25 | <Border x:Name="Main" Background="{TemplateBinding Background}" Padding="{TemplateBinding Padding}" CornerRadius="6"> |
| 26 | <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> |
| 27 | |
| 28 | <base:Img x:Name="Img" URL="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Img}" Width="16" Height="16" VerticalAlignment="Center"/> |
| 29 | <TextBlock TextOptions.TextFormattingMode="Display" Text="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=SelectedItem.Name}" VerticalAlignment="Center" Margin="5,0,0,0"/> |
| 30 | <base:Icon x:Name="PopupIcon" Width="15" Height="15" Margin="5,0,0,0" FontSize="8" IconType="CaretDownSolid8" VerticalAlignment="Center" RenderTransformOrigin=".5,.5"> |
| 31 | <base:Icon.RenderTransform> |
| 32 | <RotateTransform Angle="0" /> |
| 33 | </base:Icon.RenderTransform> |
| 34 | </base:Icon> |
| 35 | |
| 36 | </StackPanel> |
| 37 | </Border> |
| 38 | |
| 39 | |
| 40 | <Popup |
| 41 | Placement="Bottom" |
| 42 | PlacementTarget="{Binding ElementName=Main}" |
| 43 | IsOpen="{Binding RelativeSource={RelativeSource AncestorType={x:Type local:Select}}, Path=IsOpen,Mode=TwoWay}" AllowsTransparency="True" StaysOpen="False" PopupAnimation="Slide"> |
| 44 | <Border |
| 45 | CornerRadius="10" |
| 46 | BorderBrush="{DynamicResource PopupBorderBrush}" |
| 47 | BorderThickness="1" |
| 48 | Background="{DynamicResource StandardBackgroundBrush2}" Padding="5" MaxHeight="300" Margin="10"> |
| 49 | <Border.Effect> |
| 50 | <DropShadowEffect BlurRadius="10" ShadowDepth="2" Direction="315" Color="Gray" Opacity=".1"/> |
| 51 | </Border.Effect> |
| 52 | <ScrollViewer HorizontalScrollBarVisibility="Disabled"> |
| 53 | <StackPanel x:Name="OptionsContainer"> |
| 54 | |
| 55 | </StackPanel> |
| 56 | </ScrollViewer> |
| 57 | |
| 58 | </Border> |
| 59 | </Popup> |
| 60 | </Grid> |
| 61 | <VisualStateManager.VisualStateGroups> |
| 62 | <VisualStateGroup x:Name="CommonStates"> |
| 63 | <VisualStateGroup.Transitions> |
| 64 | <VisualTransition GeneratedDuration="0:0:0.18" /> |
| 65 | <VisualTransition GeneratedDuration="0" |
| 66 | To="Pressed" /> |
| 67 | </VisualStateGroup.Transitions> |
| 68 | <VisualState x:Name="Normal" /> |
| 69 | <VisualState x:Name="ShowPopup"> |
| 70 | <Storyboard> |
| 71 | <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(base:Icon.RenderTransform).(RotateTransform.Angle)" |
| 72 | Storyboard.TargetName="PopupIcon"> |
| 73 | <EasingDoubleKeyFrame KeyTime="0:0:0.18" |
| 74 | Value="-180" /> |
| 75 | |
| 76 | </DoubleAnimationUsingKeyFrames> |
| 77 | </Storyboard> |
| 78 | </VisualState> |
| 79 | </VisualStateGroup> |
| 80 | </VisualStateManager.VisualStateGroups> |
| 81 | </Border> |
| 82 | <ControlTemplate.Triggers> |
| 83 | <Trigger Property="IsMouseOver" Value="True"> |
| 84 | <Setter Property="Background" TargetName="Main" Value="{DynamicResource HoverBackgroundBrush}"/> |
| 85 | </Trigger> |
| 86 | <Trigger Property="IsShowIcon" Value="False"> |
| 87 | <Setter Property="Visibility" TargetName="Img" Value="Collapsed"/> |
| 88 | </Trigger> |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | </ControlTemplate.Triggers> |
| 99 | </ControlTemplate> |
| 100 | </Setter.Value> |
| 101 | </Setter> |
| 102 | </Style> |
| 103 | </ResourceDictionary> |