DamageRecordControl.xaml 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <UserControl x:Class="SWRIS.Controls.DamageRecordControl"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:SWRIS.Controls" xmlns:cvt="clr-namespace:SWRIS.Converters"
  7. mc:Ignorable="d"
  8. d:DesignHeight="450" d:DesignWidth="800">
  9. <UserControl.Resources>
  10. <cvt:RiskLevelToColorConverter x:Key="RiskLevelToColorConverter"/>
  11. <cvt:RiskLevelToTextConverter x:Key="RiskLevelToTextConverter"/>
  12. <Storyboard x:Key="NewItemGlowAnimation" RepeatBehavior="3x">
  13. <DoubleAnimation
  14. Storyboard.TargetProperty="Effect.Opacity"
  15. From="0" To="0.7" Duration="0:0:0.20"
  16. AutoReverse="True"/>
  17. </Storyboard>
  18. </UserControl.Resources>
  19. <Border CornerRadius="10" Background="#1e1d43">
  20. <StackPanel Orientation="Vertical">
  21. <Border CornerRadius="10">
  22. <Border.Background>
  23. <LinearGradientBrush StartPoint="0.5,0" EndPoint="0.5,1">
  24. <GradientStop Color="#1f1e44" Offset="0"/>
  25. <GradientStop Color="#36366d" Offset="1"/>
  26. </LinearGradientBrush>
  27. </Border.Background>
  28. <TextBlock Text="{Binding Title, RelativeSource={RelativeSource AncestorType=UserControl}}"
  29. HorizontalAlignment="Center" FontSize="22" FontFamily="{StaticResource PuHuiTiBold}" FontWeight="Bold" Margin="14" />
  30. </Border>
  31. <ScrollViewer MaxHeight="842" VerticalScrollBarVisibility="Hidden" Margin="25,8">
  32. <StackPanel Orientation="Vertical">
  33. <ItemsControl ItemsSource="{Binding Records, RelativeSource={RelativeSource AncestorType=UserControl}}">
  34. <ItemsControl.ItemTemplate>
  35. <DataTemplate>
  36. <Border Background="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}, ConverterParameter=0.15}"
  37. CornerRadius="10" Height="110" Width="295" Margin="0,7">
  38. <Border.Effect>
  39. <DropShadowEffect x:Name="GlowEffect"
  40. ShadowDepth="0"
  41. BlurRadius="1"
  42. Color="#00ffff"
  43. Opacity="0"/>
  44. </Border.Effect>
  45. <!-- 新项发光触发器 -->
  46. <Border.Style>
  47. <Style TargetType="Border">
  48. <Style.Triggers>
  49. <DataTrigger Binding="{Binding IsNew}" Value="True">
  50. <DataTrigger.EnterActions>
  51. <BeginStoryboard Storyboard="{StaticResource NewItemGlowAnimation}"/>
  52. </DataTrigger.EnterActions>
  53. </DataTrigger>
  54. </Style.Triggers>
  55. </Style>
  56. </Border.Style>
  57. <!-- 鼠标悬停触发器 -->
  58. <Border.Triggers>
  59. <EventTrigger RoutedEvent="MouseEnter">
  60. <BeginStoryboard>
  61. <Storyboard>
  62. <DoubleAnimation
  63. Storyboard.TargetProperty="Effect.Opacity"
  64. From="0" To="0.7" Duration="0:0:0.20"
  65. AutoReverse="True" RepeatBehavior="1x"/>
  66. </Storyboard>
  67. </BeginStoryboard>
  68. </EventTrigger>
  69. <EventTrigger RoutedEvent="MouseLeave">
  70. <BeginStoryboard>
  71. <Storyboard>
  72. <DoubleAnimation
  73. Storyboard.TargetProperty="Effect.Opacity"
  74. To="0" Duration="0:0:0.1"/>
  75. </Storyboard>
  76. </BeginStoryboard>
  77. </EventTrigger>
  78. </Border.Triggers>
  79. <StackPanel Orientation="Horizontal">
  80. <!-- 风险等级指示器 -->
  81. <Border CornerRadius="10" Width="35" Height="110"
  82. Background="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}, ConverterParameter=0.8}">
  83. <StackPanel Orientation="Vertical" VerticalAlignment="Center" HorizontalAlignment="Center">
  84. <TextBlock FontSize="18" FontWeight="Bold" FontFamily="{StaticResource PuHuiTiBold}"
  85. Text="{Binding RiskLevel, Converter={StaticResource RiskLevelToTextConverter}, ConverterParameter=0}"/>
  86. <TextBlock FontSize="18" FontWeight="Bold" FontFamily="{StaticResource PuHuiTiBold}"
  87. Text="{Binding RiskLevel, Converter={StaticResource RiskLevelToTextConverter}, ConverterParameter=1}"/>
  88. </StackPanel>
  89. </Border>
  90. <!-- 内容区域 -->
  91. <StackPanel Orientation="Vertical" VerticalAlignment="Center" Margin="18,0" Tag="{Binding Id}"
  92. MouseLeftButtonDown="Record_MouseDown" Cursor="Hand">
  93. <TextBlock Text="{Binding RopeName}" FontSize="18" FontWeight="Bold" FontFamily="{StaticResource PuHuiTiBold}"
  94. Margin="0,5,0,8"
  95. Foreground="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}}"/>
  96. <TextBlock Text="{Binding Time, StringFormat='yyyy/MM/dd HH:mm:ss'}" FontSize="18"
  97. Foreground="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}}"/>
  98. <TextBlock Text="{Binding Description}" FontSize="18" Margin="0,0,0,3"
  99. Foreground="{Binding RiskLevel, Converter={StaticResource RiskLevelToColorConverter}}"/>
  100. </StackPanel>
  101. </StackPanel>
  102. </Border>
  103. </DataTemplate>
  104. </ItemsControl.ItemTemplate>
  105. </ItemsControl>
  106. </StackPanel>
  107. </ScrollViewer>
  108. </StackPanel>
  109. </Border>
  110. </UserControl>