Files
HandyControl/Net35/HandyControl_Net35/Themes/Styles/Carousel.xaml
T
2019-01-21 00:43:10 +08:00

53 lines
3.3 KiB
XML

<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Paths.xaml"/>
<ResourceDictionary Source="Button.xaml"/>
<ResourceDictionary Source="ListBox.xaml"/>
</ResourceDictionary.MergedDictionaries>
<Style TargetType="controls:Carousel" BasedOn="{StaticResource StackPanelListBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Carousel">
<ControlTemplate.Triggers>
<EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="GridTop" Storyboard.TargetProperty="Opacity" To="1" Duration="0:0:.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
<EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
<BeginStoryboard>
<Storyboard>
<DoubleAnimation Storyboard.TargetName="GridTop" Storyboard.TargetProperty="Opacity" To="0" Duration="0:0:.1"/>
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</ControlTemplate.Triggers>
<Grid ClipToBounds="True">
<ItemsPresenter x:Name="PART_ItemsControl" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="Left"/>
<Grid Name="GridTop" Opacity="0">
<Button Command="interactivity:ControlCommands.Prev" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="30,0,0,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
<Path Margin="16" Fill="White" Style="{StaticResource LeftPathStyle}"/>
</Border>
</Button>
<Button Command="interactivity:ControlCommands.Next" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="0,0,30,0" Style="{StaticResource ButtonCustom}">
<Border Width="50" Height="100" Background="{DynamicResource DarkOpacityBrush}" CornerRadius="4">
<Path Margin="16" Fill="White" Style="{StaticResource RightPathStyle}"/>
</Border>
</Button>
</Grid>
<StackPanel Name="PART_PanelPage" Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center" Margin="0,0,0,20"/>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>