Skip to content

Commit 4f26939

Browse files
committed
TreeView
1 parent d8f5610 commit 4f26939

File tree

2 files changed

+52
-66
lines changed

2 files changed

+52
-66
lines changed

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.ListBox.xaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,6 @@
5959
</VisualStateGroup.Transitions>
6060
<VisualState Name="Selected">
6161
<Storyboard>
62-
<!--DoubleAnimation Storyboard.TargetName="SelectedBorder"
63-
Storyboard.TargetProperty="(UIElement.RenderTransform).(ScaleTransform.ScaleX)"
64-
To="1" Duration="0"/-->
6562
<DoubleAnimation Storyboard.TargetName="SelectedBorder"
6663
Storyboard.TargetProperty="Opacity"
6764
To="0.18" Duration="0"/>

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TreeView.xaml

Lines changed: 52 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2-
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
3-
2+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
3+
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"
4+
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters">
5+
6+
<ResourceDictionary.MergedDictionaries>
7+
<ResourceDictionary>
8+
<converters:BrushRoundConverter x:Key="BrushRoundConverter"/>
9+
<converters:MathNegativeConverter x:Key="MathNegativeConverter"/>
10+
</ResourceDictionary>
11+
</ResourceDictionary.MergedDictionaries>
12+
413
<Style x:Key="MaterialDesignTreeView" TargetType="{x:Type TreeView}">
514
<Setter Property="Background" Value="Transparent"/>
615
<Setter Property="BorderBrush" Value="{x:Null}"/>
@@ -164,56 +173,35 @@
164173
<RowDefinition/>
165174
</Grid.RowDefinitions>
166175
<VisualStateManager.VisualStateGroups>
167-
<VisualStateGroup x:Name="SelectionStates">
176+
<VisualStateGroup Name="CommonStates">
168177
<VisualStateGroup.Transitions>
169-
<VisualTransition GeneratedDuration="0" To="Selected">
178+
<VisualTransition GeneratedDuration="0:0:0.3" To="Normal">
170179
<VisualTransition.GeneratedEasingFunction>
171-
<CubicEase EasingMode="EaseOut"/>
180+
<CircleEase EasingMode="EaseOut"/>
172181
</VisualTransition.GeneratedEasingFunction>
173-
<Storyboard>
174-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="SelectedBorder">
175-
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
176-
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
177-
</DoubleAnimationUsingKeyFrames>
178-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="SelectedBorder">
179-
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
180-
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
181-
</DoubleAnimationUsingKeyFrames>
182-
</Storyboard>
183-
</VisualTransition>
184-
<VisualTransition GeneratedDuration="0" To="Unselected">
185-
<Storyboard>
186-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="SelectedBorder">
187-
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
188-
<EasingDoubleKeyFrame KeyTime="0:0:0.05" Value="0"/>
189-
</DoubleAnimationUsingKeyFrames>
190-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="SelectedBorder">
191-
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
192-
<EasingDoubleKeyFrame KeyTime="0:0:0.05" Value="0"/>
193-
</DoubleAnimationUsingKeyFrames>
194-
</Storyboard>
195182
</VisualTransition>
196183
</VisualStateGroup.Transitions>
197-
<VisualState x:Name="Selected">
184+
<VisualState Name="Normal"/>
185+
<VisualState Name="MouseOver">
198186
<Storyboard>
199-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="SelectedBorder">
200-
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
201-
</DoubleAnimationUsingKeyFrames>
202-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="SelectedBorder">
203-
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="1"/>
204-
</DoubleAnimationUsingKeyFrames>
187+
<DoubleAnimation Storyboard.TargetName="MouseOverBorder" Storyboard.TargetProperty="Opacity"
188+
To="0.1" Duration="0"/>
205189
</Storyboard>
206190
</VisualState>
207-
<VisualState x:Name="Unselected">
191+
<VisualState Name="Disabled"/>
192+
</VisualStateGroup>
193+
<VisualStateGroup x:Name="SelectionStates">
194+
<VisualStateGroup.Transitions>
195+
<VisualTransition GeneratedDuration="0:0:0.6"/>
196+
</VisualStateGroup.Transitions>
197+
<VisualState Name="Selected">
208198
<Storyboard>
209-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="SelectedBorder">
210-
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
211-
</DoubleAnimationUsingKeyFrames>
212-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="SelectedBorder">
213-
<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="0"/>
214-
</DoubleAnimationUsingKeyFrames>
199+
<DoubleAnimation Storyboard.TargetName="SelectedBorder"
200+
Storyboard.TargetProperty="Opacity"
201+
To="0.18" Duration="0"/>
215202
</Storyboard>
216203
</VisualState>
204+
<VisualState Name="Unselected"/>
217205
</VisualStateGroup>
218206
<VisualStateGroup x:Name="ExpansionStates">
219207
<VisualStateGroup.Transitions>
@@ -293,29 +281,37 @@
293281
</VisualState>
294282
</VisualStateGroup>
295283
</VisualStateManager.VisualStateGroups>
284+
296285
<ToggleButton x:Name="Expander" ClickMode="Press" IsChecked="{Binding IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"
297286
Style="{StaticResource MaterialDesignExpandCollapseToggleStyle}"
298287
Foreground="{TemplateBinding Foreground}"
299288
Margin="8 0 8 0"
300289
VerticalAlignment="Center"
301290
/>
302-
<Border Background="{DynamicResource MaterialDesignFlatButtonClick}" Opacity="0" RenderTransformOrigin="0.5,0.5"
303-
x:Name="SelectedBorder"
304-
Grid.Column="1" Grid.ColumnSpan="2">
305-
<Border.RenderTransform>
306-
<TransformGroup>
307-
<ScaleTransform ScaleX="0"/>
308-
<SkewTransform/>
309-
<RotateTransform/>
310-
<TranslateTransform/>
311-
</TransformGroup>
312-
</Border.RenderTransform>
313-
</Border>
314-
<Border x:Name="MouseOverBorder" Grid.Column="1" Grid.ColumnSpan="2" />
291+
292+
<Border x:Name="MouseOverBorder"
293+
Grid.Column="1" Grid.ColumnSpan="2"
294+
IsHitTestVisible="False"
295+
Opacity="0"
296+
Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"/>
297+
298+
<Border x:Name="SelectedBorder"
299+
Grid.Column="1" Grid.ColumnSpan="2"
300+
IsHitTestVisible="False"
301+
Opacity="0"
302+
Background="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"/>
303+
315304
<Grid Grid.Column="1" Grid.ColumnSpan="2" x:Name="ContentGrid" Background="Transparent">
316-
<ContentPresenter x:Name="PART_Header" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
317-
Margin="{TemplateBinding Padding}"/>
305+
<wpf:Ripple Feedback="{TemplateBinding Foreground, Converter={StaticResource BrushRoundConverter}}"
306+
Focusable="False"
307+
SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
308+
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
309+
VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
310+
Padding="{TemplateBinding Padding}">
311+
<ContentPresenter x:Name="PART_Header" ContentSource="Header"/>
312+
</wpf:Ripple>
318313
</Grid>
314+
319315
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1" RenderTransformOrigin="0,0"
320316
Opacity="0"
321317
Margin="-16 0 0 0"
@@ -337,13 +333,6 @@
337333
<Trigger Property="IsEnabled" Value="false">
338334
<Setter Property="Opacity" Value=".56"/>
339335
</Trigger>
340-
<MultiTrigger>
341-
<MultiTrigger.Conditions>
342-
<Condition Property="IsSelected" Value="False"/>
343-
<Condition SourceName="ContentGrid" Property="IsMouseOver" Value="True"/>
344-
</MultiTrigger.Conditions>
345-
<Setter Property="Background" TargetName="MouseOverBorder" Value="{DynamicResource MaterialDesignDivider}"/>
346-
</MultiTrigger>
347336
</ControlTemplate.Triggers>
348337
</ControlTemplate>
349338
</Setter.Value>

0 commit comments

Comments
 (0)