-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathDetailsViewItemTemplate.xaml
99 lines (98 loc) · 6.63 KB
/
DetailsViewItemTemplate.xaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d">
<Style x:Key="DetailsViewItemTemplate" TargetType="{x:Type GameListItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GameListItem}">
<Border Name="PART_PanelHost" Padding="10,3,0,3" Background="Transparent"
d:DataContext="{x:Static DesignMainViewModel.DesignSelectedGameIntance}">
<Grid>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<DockPanel Grid.Column="0">
<Image Name="PART_ImageIcon"
Height="{Settings DetailsViewListIconSize}"
RenderOptions.BitmapScalingMode="Fant"
DockPanel.Dock="Left" Margin="0,0,8,0" />
<TextBlock Text="{Binding DisplayName}" TextTrimming="CharacterEllipsis"
VerticalAlignment="Center" DockPanel.Dock="Left">
</TextBlock>
</DockPanel>
<!--Emtpy element to animate the space required by the icons without distorting them.-->
<ContentControl Grid.Column="1" Width="{Binding ActualWidth, ElementName=DuplicateHider_SourceSelector}">
<ContentControl.LayoutTransform>
<ScaleTransform ScaleX="0" x:Name="DummyScale"/>
</ContentControl.LayoutTransform>
</ContentControl>
</Grid>
<ContentControl Height="{Binding ElementName=PART_ImageIcon, Path=Height}">
<!--Set top/bot margin to control icon size.-->
<!--When removing fading effect, set Visibility to Visible.-->
<ContentControl x:Name="DuplicateHider_SourceSelector"
HorizontalAlignment="Right"
HorizontalContentAlignment="Right"
Visibility="Collapsed"
VerticalContentAlignment="Center"
Margin="0,4,0,4"
>
</ContentControl>
</ContentControl>
</Grid>
</Border>
<!--Fade effect. Remove or comment out <ControlTemplate.Triggers> section to deactivate animation.-->
<!--Check DuplicateHider_SourceSelector Visibility if animation is removed.-->
<ControlTemplate.Triggers>
<!--Fade in effect when mouse enters ListItem.-->
<Trigger Property="IsMouseOver" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="DuplicateHider_SourceSelector"
Storyboard.TargetProperty="Opacity"
To="1" Duration="0:0:0.15" />
<DoubleAnimation
Storyboard.TargetName="DummyScale"
Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
To="1" Duration="0:0:0.15"/>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="DuplicateHider_SourceSelector"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Visible}" KeyTime="0"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</Trigger.EnterActions>
<!--Fade out effect when mouse leaves ListItem.-->
<Trigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="DuplicateHider_SourceSelector"
Storyboard.TargetProperty="Opacity"
To="0" Duration="0:0:0.15" />
<DoubleAnimation
Storyboard.TargetName="DummyScale"
Storyboard.TargetProperty="(ScaleTransform.ScaleX)"
To="0" Duration="0:0:0.15"/>
<ObjectAnimationUsingKeyFrames
Storyboard.TargetName="DuplicateHider_SourceSelector"
Storyboard.TargetProperty="Visibility">
<DiscreteObjectKeyFrame Value="{x:Static Visibility.Collapsed}" KeyTime="0:0:0.15"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>
</Trigger.ExitActions>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>