|
1 | 1 | <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
2 | 2 | xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
3 |
| - xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"> |
| 3 | + xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf" |
| 4 | + xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"> |
4 | 5 |
|
5 | 6 | <ResourceDictionary.MergedDictionaries>
|
6 | 7 | <ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Shadows.xaml" />
|
| 8 | + <ResourceDictionary> |
| 9 | + <converters:BrushRoundConverter x:Key="BrushRoundConverter"/> |
| 10 | + </ResourceDictionary> |
7 | 11 | </ResourceDictionary.MergedDictionaries>
|
8 | 12 |
|
9 | 13 | <Style x:Key="FocusVisual">
|
|
26 | 30 | <Setter Property="Template">
|
27 | 31 | <Setter.Value>
|
28 | 32 | <ControlTemplate TargetType="{x:Type ListBoxItem}">
|
29 |
| - <ControlTemplate.Resources> |
30 |
| - <Storyboard x:Key="OnSelected"> |
31 |
| - <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity"> |
32 |
| - <EasingDoubleKeyFrame KeyTime="0:0:0.05" Value="1"> |
33 |
| - <EasingDoubleKeyFrame.EasingFunction> |
34 |
| - <CircleEase EasingMode="EaseOut" /> |
35 |
| - </EasingDoubleKeyFrame.EasingFunction> |
36 |
| - </EasingDoubleKeyFrame> |
37 |
| - </DoubleAnimationUsingKeyFrames> |
38 |
| - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="SelectedBorder"> |
39 |
| - <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="1"/> |
40 |
| - </DoubleAnimationUsingKeyFrames> |
41 |
| - </Storyboard> |
42 |
| - <Storyboard x:Key="OnUnSelected"> |
43 |
| - <DoubleAnimationUsingKeyFrames Storyboard.TargetName="SelectedBorder" Storyboard.TargetProperty="Opacity"> |
44 |
| - <EasingDoubleKeyFrame KeyTime="0:0:0.05" Value="0"> |
45 |
| - <EasingDoubleKeyFrame.EasingFunction> |
46 |
| - <CircleEase EasingMode="EaseOut" /> |
47 |
| - </EasingDoubleKeyFrame.EasingFunction> |
48 |
| - </EasingDoubleKeyFrame> |
49 |
| - </DoubleAnimationUsingKeyFrames> |
50 |
| - <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="SelectedBorder"> |
51 |
| - <EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="0"/> |
52 |
| - </DoubleAnimationUsingKeyFrames> |
53 |
| - </Storyboard> |
54 |
| - </ControlTemplate.Resources> |
55 |
| - <Grid Background="Transparent"> |
56 |
| - <Border Background="{DynamicResource MaterialDesignFlatButtonClick}" Opacity="0" RenderTransformOrigin="0.5,0.5" |
57 |
| - x:Name="SelectedBorder"> |
58 |
| - <Border.RenderTransform> |
59 |
| - <TransformGroup> |
60 |
| - <ScaleTransform ScaleX="0"/> |
61 |
| - <SkewTransform/> |
62 |
| - <RotateTransform/> |
63 |
| - <TranslateTransform/> |
64 |
| - </TransformGroup> |
65 |
| - </Border.RenderTransform> |
66 |
| - </Border> |
67 |
| - <Border x:Name="MouseOverBorder" /> |
68 |
| - <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}" |
69 |
| - Margin="{TemplateBinding Padding}"/> |
70 |
| - </Grid> |
71 |
| - <ControlTemplate.Triggers> |
72 |
| - <Trigger Property="IsSelected" Value="True"> |
73 |
| - <Trigger.EnterActions> |
74 |
| - <BeginStoryboard Storyboard="{StaticResource OnSelected}" /> |
75 |
| - </Trigger.EnterActions> |
76 |
| - <Trigger.ExitActions> |
77 |
| - <BeginStoryboard Storyboard="{StaticResource OnUnSelected}" /> |
78 |
| - </Trigger.ExitActions> |
79 |
| - </Trigger> |
80 |
| - <MultiTrigger> |
81 |
| - <MultiTrigger.Conditions> |
82 |
| - <Condition Property="IsSelected" Value="False"/> |
83 |
| - <Condition Property="IsMouseOver" Value="True"/> |
84 |
| - </MultiTrigger.Conditions> |
85 |
| - <Setter Property="Background" TargetName="MouseOverBorder" Value="{DynamicResource MaterialDesignDivider}"/> |
86 |
| - </MultiTrigger> |
87 |
| - </ControlTemplate.Triggers> |
| 33 | + <Border Background="{TemplateBinding Background}" |
| 34 | + BorderBrush="{TemplateBinding BorderBrush}" |
| 35 | + BorderThickness="{TemplateBinding BorderThickness}" |
| 36 | + Margin="{TemplateBinding Margin}" |
| 37 | + ClipToBounds="{TemplateBinding ClipToBounds}"> |
| 38 | + <VisualStateManager.VisualStateGroups> |
| 39 | + <VisualStateGroup Name="CommonStates"> |
| 40 | + <VisualStateGroup.Transitions> |
| 41 | + <VisualTransition GeneratedDuration="0:0:0.3" To="Normal"> |
| 42 | + <VisualTransition.GeneratedEasingFunction> |
| 43 | + <CircleEase EasingMode="EaseOut"/> |
| 44 | + </VisualTransition.GeneratedEasingFunction> |
| 45 | + </VisualTransition> |
| 46 | + </VisualStateGroup.Transitions> |
| 47 | + <VisualState Name="Normal"/> |
| 48 | + <VisualState Name="MouseOver"> |
| 49 | + <Storyboard> |
| 50 | + <DoubleAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="Opacity" |
| 51 | + To="0.1" Duration="0"/> |
| 52 | + </Storyboard> |
| 53 | + </VisualState> |
| 54 | + <VisualState Name="Disabled"/> |
| 55 | + </VisualStateGroup> |
| 56 | + <VisualStateGroup Name="SelectionStates"> |
| 57 | + <VisualStateGroup.Transitions> |
| 58 | + <VisualTransition GeneratedDuration="0:0:0.6"/> |
| 59 | + </VisualStateGroup.Transitions> |
| 60 | + <VisualState Name="Selected"> |
| 61 | + <Storyboard> |
| 62 | + <DoubleAnimation Storyboard.TargetName="SelectedBorder" |
| 63 | + Storyboard.TargetProperty="Opacity" |
| 64 | + To="0.18" Duration="0"/> |
| 65 | + </Storyboard> |
| 66 | + </VisualState> |
| 67 | + <VisualState Name="Unselected"/> |
| 68 | + </VisualStateGroup> |
| 69 | + </VisualStateManager.VisualStateGroups> |
| 70 | + <Grid> |
| 71 | + <Border x:Name="MouseOverBorder" |
| 72 | + Opacity="0" |
| 73 | + Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"/> |
| 74 | + |
| 75 | + <Border x:Name="SelectedBorder" |
| 76 | + Opacity="0" |
| 77 | + Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}" |
| 78 | + RenderTransformOrigin="0.5,0.5"> |
| 79 | + <Border.RenderTransform> |
| 80 | + <ScaleTransform ScaleX="1"/> |
| 81 | + </Border.RenderTransform> |
| 82 | + </Border> |
| 83 | + |
| 84 | + <wpf:Ripple Feedback="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}" |
| 85 | + Focusable="False" |
| 86 | + Content="{TemplateBinding Content}" |
| 87 | + ContentTemplate="{TemplateBinding ContentTemplate}" |
| 88 | + SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" |
| 89 | + HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" |
| 90 | + VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}" |
| 91 | + Padding="{TemplateBinding Padding}"/> |
| 92 | + </Grid> |
| 93 | + </Border> |
88 | 94 | </ControlTemplate>
|
89 | 95 | </Setter.Value>
|
90 | 96 | </Setter>
|
|
0 commit comments