Skip to content

Commit d959a39

Browse files
committed
Merge branch 'TreeViewRealExpand' of https://github.com/l1pton17/MaterialDesignInXamlToolkit into l1pton17-TreeViewRealExpand
2 parents e3ab0d4 + a65540e commit d959a39

File tree

2 files changed

+42
-60
lines changed

2 files changed

+42
-60
lines changed

MaterialDesignThemes.Wpf/Converters/MathMultipleConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,4 @@ public object[] ConvertBack(object value, Type[] targetTypes, object parameter,
4040
throw new NotImplementedException();
4141
}
4242
}
43-
}
43+
}

MaterialDesignThemes.Wpf/Themes/MaterialDesignTheme.TreeView.xaml

Lines changed: 41 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
22
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
33
xmlns:wpf="clr-namespace:MaterialDesignThemes.Wpf"
4-
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters">
4+
xmlns:converters="clr-namespace:MaterialDesignThemes.Wpf.Converters"
5+
xmlns:system="clr-namespace:System;assembly=mscorlib">
56

67
<ResourceDictionary.MergedDictionaries>
78
<ResourceDictionary>
89
<converters:BrushRoundConverter x:Key="BrushRoundConverter"/>
10+
<converters:MathMultipleConverter x:Key="MathMlpMultipleConverter" Operation="Multiply" />
911
</ResourceDictionary>
1012
</ResourceDictionary.MergedDictionaries>
1113

@@ -176,7 +178,7 @@
176178
<VisualStateGroup.Transitions>
177179
<VisualTransition GeneratedDuration="0:0:0.3" To="Normal">
178180
<VisualTransition.GeneratedEasingFunction>
179-
<CircleEase EasingMode="EaseOut"/>
181+
<CubicEase EasingMode="EaseOut"/>
180182
</VisualTransition.GeneratedEasingFunction>
181183
</VisualTransition>
182184
</VisualStateGroup.Transitions>
@@ -212,67 +214,41 @@
212214
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
213215
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
214216
</ObjectAnimationUsingKeyFrames>
215-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost">
216-
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
217-
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
218-
</DoubleAnimationUsingKeyFrames>
219-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ItemsHost">
220-
<EasingDoubleKeyFrame KeyTime="0" Value=".5"/>
221-
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
222-
</DoubleAnimationUsingKeyFrames>
223-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ItemsHost">
224-
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
225-
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="1"/>
226-
</DoubleAnimationUsingKeyFrames>
217+
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost"
218+
To="1" Duration="0:0:0.3"/>
219+
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer"
220+
To="1" Duration="0:0:0.3"/>
227221
</Storyboard>
228222
</VisualTransition>
229223
<VisualTransition GeneratedDuration="0" To="Collapsed">
230224
<Storyboard>
231225
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
232-
<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Collapsed}" />
226+
<DiscreteObjectKeyFrame KeyTime="0:0:0.3" Value="{x:Static Visibility.Collapsed}" />
233227
</ObjectAnimationUsingKeyFrames>
234-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost">
235-
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
236-
<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="0"/>
237-
</DoubleAnimationUsingKeyFrames>
238-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ItemsHost">
239-
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
240-
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value=".5"/>
241-
</DoubleAnimationUsingKeyFrames>
242-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ItemsHost">
243-
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
244-
<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="0"/>
245-
</DoubleAnimationUsingKeyFrames>
228+
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost"
229+
To="0" Duration="0:0:0.3"/>
230+
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer"
231+
To="0" Duration="0:0:0.3"/>
246232
</Storyboard>
247233
</VisualTransition>
248234
</VisualStateGroup.Transitions>
249235
<VisualState x:Name="Expanded">
250236
<Storyboard>
251-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost">
252-
<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
253-
</DoubleAnimationUsingKeyFrames>
254-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ItemsHost">
255-
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
256-
</DoubleAnimationUsingKeyFrames>
257-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ItemsHost">
258-
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="1"/>
259-
</DoubleAnimationUsingKeyFrames>
237+
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost"
238+
To="1" Duration="0"/>
239+
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer"
240+
To="1" Duration="0"/>
260241
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
261242
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}" />
262243
</ObjectAnimationUsingKeyFrames>
263244
</Storyboard>
264245
</VisualState>
265246
<VisualState x:Name="Collapsed">
266247
<Storyboard>
267-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost">
268-
<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
269-
</DoubleAnimationUsingKeyFrames>
270-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="ItemsHost">
271-
<EasingDoubleKeyFrame KeyTime="0:0:0" Value=".5"/>
272-
</DoubleAnimationUsingKeyFrames>
273-
<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.LayoutTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="ItemsHost">
274-
<EasingDoubleKeyFrame KeyTime="0:0:0" Value="0"/>
275-
</DoubleAnimationUsingKeyFrames>
248+
<DoubleAnimation Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ItemsHost"
249+
To="0" Duration="0"/>
250+
<DoubleAnimation Storyboard.TargetProperty="Tag" Storyboard.TargetName="ItemsScrollViewer"
251+
To="0" Duration="0"/>
276252
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="ItemsHost" Storyboard.TargetProperty="Visibility">
277253
<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}" />
278254
</ObjectAnimationUsingKeyFrames>
@@ -310,20 +286,26 @@
310286
<ContentPresenter x:Name="PART_Header" ContentSource="Header"/>
311287
</wpf:Ripple>
312288
</Grid>
313-
314-
<ItemsPresenter x:Name="ItemsHost" Grid.ColumnSpan="2" Grid.Column="1" Grid.Row="1" RenderTransformOrigin="0,0"
315-
Opacity="0"
316-
Margin="-16 0 0 0"
317-
Visibility="Collapsed">
318-
<ItemsPresenter.LayoutTransform>
319-
<TransformGroup>
320-
<ScaleTransform ScaleX=".5" ScaleY="0"/>
321-
<SkewTransform/>
322-
<RotateTransform/>
323-
<TranslateTransform/>
324-
</TransformGroup>
325-
</ItemsPresenter.LayoutTransform>
326-
</ItemsPresenter>
289+
290+
<ScrollViewer Grid.Column="1" Grid.Row="1"
291+
x:Name="ItemsScrollViewer"
292+
Margin="-16 0 0 0"
293+
VerticalScrollBarVisibility="Hidden"
294+
Grid.ColumnSpan="2">
295+
<ScrollViewer.Tag>
296+
<system:Double>0.0</system:Double>
297+
</ScrollViewer.Tag>
298+
<ScrollViewer.Height>
299+
<MultiBinding Converter="{StaticResource MathMlpMultipleConverter}">
300+
<Binding ElementName="ItemsHost" Path="ActualHeight"/>
301+
<Binding RelativeSource="{RelativeSource Self}" Path="Tag"/>
302+
</MultiBinding>
303+
</ScrollViewer.Height>
304+
<ItemsPresenter x:Name="ItemsHost"
305+
VerticalAlignment="Top"
306+
Opacity="0"
307+
Visibility="Collapsed"/>
308+
</ScrollViewer>
327309
</Grid>
328310
<ControlTemplate.Triggers>
329311
<Trigger Property="HasItems" Value="false">

0 commit comments

Comments
 (0)