TimeBar.xaml 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. <ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:hc="clr-namespace:HandyControl.Controls">
  4. <Style TargetType="hc:TimeBar">
  5. <Setter Property="HotspotsBrush" Value="{DynamicResource AccentBrush}"/>
  6. <Setter Property="Focusable" Value="False"/>
  7. <Setter Property="UseLayoutRounding" Value="True"/>
  8. <Setter Property="BorderThickness" Value="0,1,0,0"/>
  9. <Setter Property="Foreground" Value="White"/>
  10. <Setter Property="Background" Value="{DynamicResource TitleBrush}"/>
  11. <Setter Property="Height" Value="60"/>
  12. <Setter Property="BorderBrush" Value="{DynamicResource BorderBrush}"/>
  13. <Setter Property="Template">
  14. <Setter.Value>
  15. <ControlTemplate TargetType="hc:TimeBar">
  16. <ControlTemplate.Triggers>
  17. <EventTrigger RoutedEvent="FrameworkElement.MouseEnter">
  18. <BeginStoryboard>
  19. <Storyboard>
  20. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_TextBlockMove">
  21. <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
  22. </ObjectAnimationUsingKeyFrames>
  23. </Storyboard>
  24. </BeginStoryboard>
  25. </EventTrigger>
  26. <EventTrigger RoutedEvent="FrameworkElement.MouseLeave">
  27. <BeginStoryboard>
  28. <Storyboard>
  29. <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="PART_TextBlockMove">
  30. <DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Collapsed}"/>
  31. </ObjectAnimationUsingKeyFrames>
  32. </Storyboard>
  33. </BeginStoryboard>
  34. </EventTrigger>
  35. </ControlTemplate.Triggers>
  36. <Border Background="{TemplateBinding Background}" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
  37. <hc:SimplePanel ClipToBounds="True">
  38. <Border BorderThickness="0,0,0,4" BorderBrush="White" VerticalAlignment="Top" Height="52">
  39. <TextBlock FontSize="16" Name="PART_TextBlockSelected" VerticalAlignment="Top" Margin="0,14,0,0" HorizontalAlignment="Center"/>
  40. </Border>
  41. <TextBlock Visibility="{TemplateBinding ShowSpeStr,Converter={StaticResource Boolean2VisibilityConverter}}" Text="{TemplateBinding SpeStr}" HorizontalAlignment="Right" VerticalAlignment="Top" Margin="0,14,10,0"/>
  42. <TextBlock Visibility="Collapsed" Name="PART_TextBlockMove" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,2,0,0"/>
  43. <Canvas Name="PART_CanvasSpe" VerticalAlignment="Bottom" Height="28"/>
  44. <hc:SimplePanel x:Name="PART_Hotspots" Margin="0,48,0,0" VerticalAlignment="Top" Visibility="{Binding Hotspots,RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource Object2VisibilityConverter}}"/>
  45. <Border Width="1" Background="{DynamicResource DangerBrush}"/>
  46. <Border Name="PART_BorderTop" Background="Transparent" Cursor="Hand"/>
  47. </hc:SimplePanel>
  48. </Border>
  49. </ControlTemplate>
  50. </Setter.Value>
  51. </Setter>
  52. </Style>
  53. </ResourceDictionary>